From 626fdd0c75e302cdb9a28b9411aea99869e6887d Mon Sep 17 00:00:00 2001 From: Alex McKenzie Date: Mon, 4 Aug 2025 15:13:58 -0400 Subject: [PATCH 1/4] upgrade to node 20 --- .github/workflows/test.yml | 19 ++++++------------- docker-compose.yml | 8 ++++---- jest.config.ts | 6 ++---- lib/delete.ts | 6 +++--- package.json | 39 +++++++++++++++++++------------------- tsconfig.json | 4 ++-- 6 files changed, 36 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff908d0..5998d78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,25 +22,18 @@ jobs: - 8000:8000 strategy: matrix: - node-version: [12.x, 14.x, 16.x] + node-version: [20.x, 22.x, 24.x] # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - - name: Cache Npm - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }} + cache: 'npm' - name: Install run: npm install @@ -53,8 +46,8 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ matrix.node-version }} AWS_SECRET_ACCESS_KEY: ${{ matrix.node-version }} - AWS_DEFAULT_REGION: "us-east-1" - CODECOV_TOKEN: ${{ matrix.node-version == '16.x' && secrets.CODECOV_TOKEN || '' }} + AWS_DEFAULT_REGION: 'us-east-1' + CODECOV_TOKEN: ${{ matrix.node-version == '24.x' && secrets.CODECOV_TOKEN || '' }} - name: Publish Unit Test Results uses: mikepenz/action-junit-report@v3 diff --git a/docker-compose.yml b/docker-compose.yml index 6af974e..adddc9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ -version: "3.8" +version: '3.8' services: dynamodb-local: - command: "-jar DynamoDBLocal.jar -inMemory -sharedDb" - image: "amazon/dynamodb-local:latest" + command: '-jar DynamoDBLocal.jar -inMemory -sharedDb' + image: 'amazon/dynamodb-local:latest' ports: - - "8000:8000" + - '8000:8000' working_dir: /home/dynamodblocal diff --git a/jest.config.ts b/jest.config.ts index b8c0145..4040f04 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -3,9 +3,7 @@ export default { testEnvironment: 'node', reporters: ['default', 'jest-junit'], testPathIgnorePatterns: ['^.+\\.js$'], - globals: { - 'ts-jest': { - isolatedModules: true, - }, + transform: { + '^.+\\.ts$': ['ts-jest'], }, }; diff --git a/lib/delete.ts b/lib/delete.ts index 8359b15..ad538ba 100644 --- a/lib/delete.ts +++ b/lib/delete.ts @@ -45,7 +45,7 @@ export async function deleteSingleItem< T, PK extends Keys, SK extends Keys, - U = Pick & Partial, + U extends Partial = Pick & Partial, >( facet: Facet, record: U, @@ -100,7 +100,7 @@ export async function deleteItems< T, PK extends Keys, SK extends Keys, - U = Pick & Partial, + U extends Partial = Pick & Partial, >(facet: Facet, records: U[]): Promise> { const recordsToBatch: U[] = [...records]; const deleteResponse: DeleteResponse = { @@ -153,7 +153,7 @@ async function deleteBatch< T, PK extends Keys, SK extends Keys, - U = Pick & Partial, + U extends Partial = Pick & Partial, >(facet: Facet, batchToDelete: U[]): Promise> { const deleteRequests: Record = {}; const deleteResponse: DeleteResponse = { diff --git a/package.json b/package.json index daad0c2..6b24735 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "prepublishOnly": "npm run build" }, "engines": { - "node": ">=12.4.0" + "node": ">=20.0.0" }, "keywords": [ "DynamoDB" @@ -33,32 +33,31 @@ }, "homepage": "https://github.com/faceteer/facet#readme", "devDependencies": { - "@aws-sdk/client-dynamodb": ">=3.0.0 <=3.193.0", - "@types/jest": "^27.0.1", - "@types/node": "^15.6.1", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", + "@aws-sdk/client-dynamodb": ">=3.0.0 <=3.859.0", + "@types/jest": "^29.0.0", + "@types/node": "^20.0.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "codecov": "^3.8.2", - "eslint": "^7.27.0", + "eslint": "^8.0.0", "eslint-config-google": "^0.14.0", - "eslint-config-prettier": "^8.3.0", - "eslint-config-standard": "^16.0.1", + "eslint-config-prettier": "^9.0.0", + "eslint-config-standard": "^17.0.0", "eslint-import-resolver-node": "^0.3.2", - "eslint-plugin-import": "^2.20.2", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^5.0.0", - "jest": "^27.0.6", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-n": "^16.0.0", + "eslint-plugin-prettier": "^5.0.0", + "eslint-plugin-promise": "^6.0.0", + "jest": "^29.0.0", "jest-junit": "^12.2.0", - "prettier": "^2.3.0", - "ts-jest": "^27.0.5", + "prettier": "^3.0.0", + "ts-jest": "^29.0.0", "ts-node": "^10.1.0", - "typedoc": "^0.22.10", - "typescript": "~4.3.2" + "typedoc": "^0.25.0", + "typescript": "^5.0.0" }, "peerDependencies": { - "@aws-sdk/client-dynamodb": ">=3.0.0 <=3.193.0" + "@aws-sdk/client-dynamodb": ">=3.0.0 <=3.859.0" }, "dependencies": { "@faceteer/converter": "^2.0.3", diff --git a/tsconfig.json b/tsconfig.json index 8491da5..c1d7efd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "lib": ["ES2020"], - "target": "ES2019", + "lib": ["ES2022"], + "target": "ES2022", "module": "CommonJS", "moduleResolution": "node", "noUnusedLocals": true, From 79e35518eeff7905151740b68141ea9c51c469ae Mon Sep 17 00:00:00 2001 From: Alex McKenzie Date: Mon, 4 Aug 2025 15:16:18 -0400 Subject: [PATCH 2/4] remove caching from test --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5998d78..0a01f19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'npm' - name: Install run: npm install From 483f5ae9b3cd13149db9858187bd16abb41b87c6 Mon Sep 17 00:00:00 2001 From: Alex McKenzie Date: Mon, 4 Aug 2025 15:19:06 -0400 Subject: [PATCH 3/4] update dummy credentials --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a01f19..764b732 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,8 +43,8 @@ jobs: - name: Run Jest Tests run: npm run test:ci env: - AWS_ACCESS_KEY_ID: ${{ matrix.node-version }} - AWS_SECRET_ACCESS_KEY: ${{ matrix.node-version }} + AWS_ACCESS_KEY_ID: test + AWS_SECRET_ACCESS_KEY: test AWS_DEFAULT_REGION: 'us-east-1' CODECOV_TOKEN: ${{ matrix.node-version == '24.x' && secrets.CODECOV_TOKEN || '' }} From 1f043c5a0681ec0f30480a1305321b151223ff41 Mon Sep 17 00:00:00 2001 From: Alex McKenzie Date: Mon, 4 Aug 2025 15:22:11 -0400 Subject: [PATCH 4/4] uninstall codecov --- .github/workflows/test.yml | 9 ++++++++- package.json | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 764b732..56fd257 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,14 @@ jobs: AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test AWS_DEFAULT_REGION: 'us-east-1' - CODECOV_TOKEN: ${{ matrix.node-version == '24.x' && secrets.CODECOV_TOKEN || '' }} + + - name: Upload coverage to Codecov + if: matrix.node-version == '24.x' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage/lcov.info + fail_ci_if_error: false - name: Publish Unit Test Results uses: mikepenz/action-junit-report@v3 diff --git a/package.json b/package.json index 6b24735..992fe48 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "test": "jest --runInBand --silent --coverage", - "test:ci": "jest --ci --runInBand --silent --coverage && codecov", + "test:ci": "jest --ci --runInBand --silent --coverage", "build:clean": "tsc -b --clean", "build": "tsc -b --clean && tsc -b", "prepublishOnly": "npm run build" @@ -38,7 +38,6 @@ "@types/node": "^20.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", - "codecov": "^3.8.2", "eslint": "^8.0.0", "eslint-config-google": "^0.14.0", "eslint-config-prettier": "^9.0.0",