From bce4f649ed690da186804c9f98a6be4c493adedc Mon Sep 17 00:00:00 2001 From: legobeat <109787230+legobeat@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:02:32 +0000 Subject: [PATCH] drop support for Node.js versions 16, 21 (#390) * drop support for Node.js versions 16, 21 * ci: modern node modules caching --- .github/workflows/build-test.yml | 63 +++++++++++--------------------- package.json | 4 +- yarn.lock | 26 +++++++------ 3 files changed, 38 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index db00794a..5447b779 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -9,29 +9,19 @@ jobs: prepare: name: Prepare runs-on: ubuntu-latest - outputs: - YARN_CACHE_DIR: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }} - YARN_VERSION: ${{ steps.yarn-version.outputs.YARN_VERSION }} strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: + - 18.x + - 20.x + - 22.x steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Get Yarn cache directory - run: echo "YARN_CACHE_DIR=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" - id: yarn-cache-dir - - name: Get Yarn version - run: echo "YARN_VERSION=$(yarn --version)" >> "$GITHUB_OUTPUT" - id: yarn-version - - name: Cache Yarn dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }} - key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} + cache: 'yarn' - name: Install Yarn dependencies run: yarn --immutable build: @@ -41,18 +31,17 @@ jobs: - prepare strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: + - 18.x + - 20.x + - 22.x steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Restore Yarn dependencies - uses: actions/cache@v3 - with: - path: ${{ needs.prepare.outputs.YARN_CACHE_DIR }} - key: yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} + cache: 'yarn' - run: yarn --immutable - run: yarn build - name: Require clean working directory @@ -67,20 +56,13 @@ jobs: runs-on: ubuntu-latest needs: - prepare - strategy: - matrix: - node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - name: Restore Yarn dependencies - uses: actions/cache@v3 + - name: Set up Node.js + uses: actions/setup-node@v4 with: - path: ${{ needs.prepare.outputs.YARN_CACHE_DIR }} - key: yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} + node-version-file: '.nvmrc' + cache: 'yarn' - run: yarn --immutable - run: yarn lint - name: Validate RC changelog @@ -103,18 +85,17 @@ jobs: - prepare strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: + - 18.x + - 20.x + - 22.x steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Restore Yarn dependencies - uses: actions/cache@v3 - with: - path: ${{ needs.prepare.outputs.YARN_CACHE_DIR }} - key: yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} + cache: 'yarn' - run: yarn --immutable - run: yarn test - name: Require clean working directory diff --git a/package.json b/package.json index 960ccdf8..974ab871 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@metamask/eslint-config-nodejs": "^11.1.0", "@metamask/eslint-config-typescript": "^11.1.0", "@types/jest": "^27.0.6", - "@types/node": "^16.18.50", + "@types/node": "~18.18.14", "@typescript-eslint/eslint-plugin": "^5.59.1", "@typescript-eslint/parser": "^5.59.1", "ajv": "^8.11.0", @@ -80,7 +80,7 @@ }, "packageManager": "yarn@3.2.2", "engines": { - "node": "^16.20 || ^18.16 || >=20" + "node": "^18.18 || ^20.14 || >=22" }, "publishConfig": { "access": "public", diff --git a/yarn.lock b/yarn.lock index 78cc0a48..af32977f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -905,7 +905,7 @@ __metadata: "@metamask/utils": ^9.0.0 "@scure/base": ~1.1.3 "@types/jest": ^27.0.6 - "@types/node": ^16.18.50 + "@types/node": ~18.18.14 "@typescript-eslint/eslint-plugin": ^5.59.1 "@typescript-eslint/parser": ^5.59.1 ajv: ^8.11.0 @@ -1243,17 +1243,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": - version: 18.7.6 - resolution: "@types/node@npm:18.7.6" - checksum: 5122988c325eda8d1f5cbe4494916036aae1758f9d5bb2d8139a800b8bad1540fbb167cd3c759da9a5cb4600cd3507609ac7969747113c1549a3e4320a17b1a9 - languageName: node - linkType: hard - -"@types/node@npm:^16.18.50": - version: 16.18.50 - resolution: "@types/node@npm:16.18.50" - checksum: 8aec1eaf83407197ec2fe947182c238f49b82a7aace867cee1f81f72eb8a76c3c8b2adb1fd356e7443317cffb2546708da8934299a579edd25e3160bf7af30a1 +"@types/node@npm:*, @types/node@npm:~18.18.14": + version: 18.18.14 + resolution: "@types/node@npm:18.18.14" + dependencies: + undici-types: ~5.26.4 + checksum: 3a77e6819e50fd22196b08d542433e1513c855f4993a200bc0e7be076445c61ce2a9e5f7f202f060c46130b2b2f98643461fb7999f874475e6bb322c4534c580 languageName: node linkType: hard @@ -5904,6 +5899,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "unique-filename@npm:^1.1.1": version: 1.1.1 resolution: "unique-filename@npm:1.1.1"