diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index dec7b190..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: ci -on: - push: - branches: - - '*' - pull_request: - branches: - - main - - development - -jobs: - build: - name: Build - runs-on: ubuntu-latest - services: - redis: - image: redis - ports: - - 6379:6379 - steps: - - name: Checkout code - uses: actions/checkout@v5 - - - name: Set up nodejs - uses: actions/setup-node@v6 - with: - # @TODO: rollback to 'lts/*' - node-version: '22' - cache: 'npm' - - - name: npm CI - run: npm ci - - - name: npm Check - run: npm run check - - - name: npm Test - run: npm run test - - - name: npm Build - run: npm run build diff --git a/.github/workflows/update-notice-year.yml b/.github/workflows/update-notice-year.yml deleted file mode 100644 index 7043f6f0..00000000 --- a/.github/workflows/update-notice-year.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Update Notice Year - -on: - schedule: - - cron: "0 3 1 1 *" # 03:00 AM on January 1 - -permissions: - contents: write - pull-requests: write - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Set Current year - run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" - - - name: Set Previous Year - run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" - - - name: Update NOTICE - uses: jacobtomlinson/gha-find-replace@v3 - with: - find: ${{ env.PREVIOUS }} - replace: ${{ env.CURRENT }} - include: "NOTICE" - regex: false - - - name: Commit files - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git commit -m "Updated Notice Year" -a - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: Update Notice Year - branch: update-notice diff --git a/.harness/ci.yaml b/.harness/ci.yaml new file mode 100644 index 00000000..09c4b888 --- /dev/null +++ b/.harness/ci.yaml @@ -0,0 +1,82 @@ +pipeline: + name: javascript-commons + identifier: javascriptcommons + projectIdentifier: Harness_Split + orgIdentifier: PROD + tags: {} + properties: + ci: + codebase: + connectorRef: fmegithubharnessgitops + repoName: javascript-commons + build: <+input> + stages: + - stage: + name: Check-Test-Build + identifier: Checkout_code + description: "" + type: CI + spec: + cloneCodebase: true + caching: + enabled: true + override: true + paths: [] + platform: + os: Linux + arch: Amd64 + runtime: + type: Cloud + spec: + size: small + imageSpec: + imageName: ubuntu-latest + buildIntelligence: + enabled: false + execution: + steps: + - step: + type: Run + name: Install and run redis-server + identifier: redis_server + spec: + shell: Sh + command: |- + apt-get update && apt-get install -y redis-server + redis-server --daemonize yes + - step: + type: Action + name: Set up Node.js + identifier: Set_up_Nodejs + spec: + uses: dcodeIO/setup-node-nvm@master + with: + node-version: lts/* + - step: + type: Run + name: npm ci + identifier: npm_ci + spec: + shell: Sh + command: npm ci + - step: + type: Run + name: npm run check + identifier: npm_run_check + spec: + shell: Sh + command: npm run check + - step: + type: Run + name: npm run test + identifier: npm_run_test + spec: + shell: Sh + command: npm run test + - step: + type: Run + name: npm run build + identifier: npm_run_build + spec: + shell: Sh + command: npm run build diff --git a/.harness/input-set.yaml b/.harness/input-set.yaml new file mode 100644 index 00000000..ba0c8ec1 --- /dev/null +++ b/.harness/input-set.yaml @@ -0,0 +1,15 @@ +inputSet: + name: javascript-commons + tags: {} + identifier: javascriptcommons + orgIdentifier: PROD + projectIdentifier: Harness_Split + pipeline: + identifier: javascriptcommons + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch> diff --git a/.nvmrc b/.nvmrc index 8fdd954d..b009dfb9 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22 \ No newline at end of file +lts/* diff --git a/package-lock.json b/package-lock.json index 4c355d52..8cafaa1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,6 +93,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.5.tgz", "integrity": "sha512-SBuTAjg91A3eKOvD+bPEz3LlhHZRNu1nFOVts9lzDJTXshHTjII0BAtDS3Y2DAkdZdDKWVZGVwkDfc4Clxn1dg==", "dev": true, + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.22.5", @@ -1546,6 +1547,7 @@ "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz", "integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==", "dev": true, + "peer": true, "dependencies": { "jest-diff": "^27.0.0", "pretty-format": "^27.0.0" @@ -1663,6 +1665,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "6.21.0", "@typescript-eslint/types": "6.21.0", @@ -1873,6 +1876,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2257,6 +2261,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001663", "electron-to-chromium": "^1.5.28", @@ -2904,6 +2909,7 @@ "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -4600,6 +4606,7 @@ "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", "integrity": "sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==", "dev": true, + "peer": true, "dependencies": { "@jest/core": "^27.5.1", "import-local": "^3.0.2", @@ -6659,6 +6666,7 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, + "peer": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -7800,6 +7808,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/src/__tests__/testUtils/csv.ts b/src/__tests__/testUtils/csv.ts index 4927cea4..545e3b30 100644 --- a/src/__tests__/testUtils/csv.ts +++ b/src/__tests__/testUtils/csv.ts @@ -1,18 +1,16 @@ import fs from 'fs'; -import rl from 'readline'; export function readCSV(filePath: string, delimiter = ','): Promise { - return new Promise((resolve) => { - const parser = rl.createInterface({ - input: fs.createReadStream(filePath) - }); + return new Promise((resolve, reject) => { + fs.readFile(filePath, 'utf8', (err, content) => { + if (err) return reject(err); - const data: string[][] = []; + const lines = content.split(/\r?\n/); + const data = lines + .filter(line => line.trim().length > 0) + .map(line => line.split(delimiter)); - parser - .on('line', line => { - data.push(line.split(delimiter)); - }) - .on('close', () => resolve(data)); + resolve(data); + }); }); }