Skip to content

Commit

Permalink
enhancement: add support for Node 22 (strapi#21467)
Browse files Browse the repository at this point in the history
  • Loading branch information
innerdvations authored Oct 9, 2024
1 parent 53c97b9 commit 51d9cfe
Show file tree
Hide file tree
Showing 56 changed files with 175 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/strapi/strapi/blob/main/CONTRIBUTING.md#reporting-an-issue

### Required System information

<!-- Please ensure you are using the Node LTS version (v18 or v20) -->
<!-- Please ensure you are using the Node LTS version (18, 20, or 22) -->
<!-- Strapi v3 is no longer supported, please update to Strapi v4 -->
<!-- If you are reporting a frontend bug please provide error logs after setting STRAPI_ENFORCE_SOURCEMAPS=true in your .env -->
<!-- This environment variable makes frontend errors easier to read and trace -->
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/check-pr-status/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This action checks a PR labels, milestone and status to validate it is ready for

### Requirements

- The code is compatible with Node 18, and 20
- The code is compatible with Node 18, 20, and 22

### Dependencies

Expand Down
89 changes: 52 additions & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,37 @@ jobs:
filters: .github/filters.yaml

pretty:
name: 'pretty (node: 20)'
name: 'pretty (node: ${{ matrix.node }})'
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node }}
- uses: nrwl/nx-set-shas@v4
- name: Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: Run lint
run: yarn prettier:check

lint:
name: 'lint (node: 20)'
needs: [build]
name: 'lint (node: ${{ matrix.node }})'
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node }}
- uses: nrwl/nx-set-shas@v4
- name: Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -72,29 +77,35 @@ jobs:
run: yarn nx affected --target=lint --parallel --nx-ignore-cycles

build:
name: 'build (node: 20)'
name: 'build (node: ${{ matrix.node }})'
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node }}
- name: Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: Monorepo build
uses: ./.github/actions/run-build

typescript:
name: 'typescript'
needs: [build]
name: 'typescript (node: ${{ matrix.node }})'
needs: [changes, lint, pretty, build]
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node }}
- uses: nrwl/nx-set-shas@v4
- name: Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -108,14 +119,15 @@ jobs:
run: yarn nx affected --target=test:ts:front --nx-ignore-cycles

unit_back:
if: needs.changes.outputs.backend == 'true'
name: 'unit_back (node: ${{ matrix.node }})'
needs: [changes, build]
needs: [changes, lint, pretty, build]
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
strategy:
matrix:
node: [18, 20]
node: [20, 22]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -133,9 +145,10 @@ jobs:

unit_front:
name: 'unit_front (node: ${{ matrix.node }})'
needs: [changes, build]
needs: [changes, lint, pretty, build]
runs-on: ubuntu-latest
strategy:
fail-fast: false # remove once tests aren't flaky
matrix:
node: [20]
steps:
Expand All @@ -150,16 +163,17 @@ jobs:
uses: ./.github/actions/yarn-nm-install
- name: Monorepo build
uses: ./.github/actions/run-build
- name: Run test
- name: Run tests
run: yarn nx affected --target=test:front --nx-ignore-cycles -- --runInBand

e2e_ce:
if: needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true'
timeout-minutes: 60
needs: [changes, build]
needs: [changes, lint, pretty, build]
name: '[CE] e2e (browser: ${{ matrix.project }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
fail-fast: false # remove once tests aren't flaky
matrix:
project: ['chromium', 'webkit', 'firefox']
shard: [1/2, 2/2]
Expand Down Expand Up @@ -195,14 +209,15 @@ jobs:
retention-days: 1

e2e_ee:
if: needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true'
timeout-minutes: 60
needs: [changes, build]
needs: [changes, lint, pretty, build]
name: '[EE] e2e (browser: ${{ matrix.project }})'
runs-on: ubuntu-latest
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
fail-fast: false
fail-fast: false # remove once tests aren't flaky
matrix:
project: ['chromium', 'webkit', 'firefox']
shard: [1/2, 2/2]
Expand Down Expand Up @@ -239,18 +254,22 @@ jobs:
retention-days: 1

cli:
if: needs.changes.outputs.backend == 'true'
timeout-minutes: 60
needs: [changes, build, typescript]
name: 'CLI Tests'
needs: [changes, lint, pretty, build]
name: 'CLI Tests (node: ${{ matrix.node }})'
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{ matrix.node }}

- name: Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -264,17 +283,15 @@ jobs:
api_ce_pg:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [changes, build]
needs: [changes, lint, pretty, build]
name: '[CE] API Integration (postgres, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
services:
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
Expand Down Expand Up @@ -306,11 +323,11 @@ jobs:
api_ce_mysql:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [changes, build, typescript, unit_back, unit_front]
needs: [changes, lint, pretty, build]
name: '[CE] API Integration (mysql:latest, package: mysql2}, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
services:
mysql:
Expand Down Expand Up @@ -345,11 +362,11 @@ jobs:
api_ce_sqlite:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [changes, build, typescript, unit_back, unit_front]
needs: [changes, lint, pretty, build]
name: '[CE] API Integration (sqlite, package: better-sqlite3, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
steps:
- uses: actions/checkout@v4
Expand All @@ -368,20 +385,18 @@ jobs:
# EE
api_ee_pg:
runs-on: ubuntu-latest
needs: [changes, build]
needs: [changes, lint, pretty, build]
name: '[EE] API Integration (postgres, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
services:
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
Expand Down Expand Up @@ -413,14 +428,14 @@ jobs:

api_ee_mysql:
runs-on: ubuntu-latest
needs: [changes, build, typescript, unit_back, unit_front]
needs: [changes, lint, pretty, build]
name: '[EE] API Integration (mysql:latest, package: mysql2, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
services:
mysql:
Expand Down Expand Up @@ -455,14 +470,14 @@ jobs:

api_ee_sqlite:
runs-on: ubuntu-latest
needs: [changes, build, typescript, unit_back, unit_front]
needs: [changes, lint, pretty, build]
name: '[EE] API Integration (sqlite, client: better-sqlite3, node: ${{ matrix.node }}, shard: ${{ matrix.shard }})'
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
matrix:
node: [18, 20]
node: [20, 22]
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The Strapi core team will review your pull request and either merge it, request

## Contribution Prerequisites

- You have [Node.js](https://nodejs.org/en/) at version `>= v18 and <= v20` and [Yarn](https://yarnpkg.com/en/) at v1.2.0+ installed.
- You have [Node.js](https://nodejs.org/en/) at version `>= v18 and <= v22` and [Yarn](https://yarnpkg.com/en/) at v1.2.0+ installed.
- You are familiar with [Git](https://git-scm.com).

**Before submitting your pull request** make sure the following requirements are fulfilled:
Expand Down
4 changes: 2 additions & 2 deletions examples/experimental-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"dependencies": {
"@strapi/plugin-users-permissions": "workspace:*",
"@strapi/strapi": "workspace:*",
"better-sqlite3": "9.4.3",
"better-sqlite3": "11.3.0",
"react": "rc",
"react-dom": "rc",
"react-router-dom": "6.22.3",
"styled-components": "6.1.8"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/getstarted/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@strapi/provider-upload-aws-s3": "workspace:*",
"@strapi/provider-upload-cloudinary": "workspace:*",
"@strapi/strapi": "workspace:*",
"better-sqlite3": "9.4.3",
"better-sqlite3": "11.3.0",
"lodash": "4.17.21",
"mysql2": "3.9.4",
"passport-google-oauth2": "0.2.0",
Expand All @@ -36,7 +36,7 @@
"styled-components": "6.1.8"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
Expand Down
4 changes: 2 additions & 2 deletions examples/kitchensink-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"dependencies": {
"@strapi/plugin-users-permissions": "workspace:*",
"@strapi/strapi": "workspace:*",
"better-sqlite3": "9.4.3",
"better-sqlite3": "11.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.22.3",
"styled-components": "6.1.8"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
Expand Down
4 changes: 2 additions & 2 deletions examples/kitchensink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@strapi/provider-upload-aws-s3": "workspace:*",
"@strapi/provider-upload-cloudinary": "workspace:*",
"@strapi/strapi": "workspace:*",
"better-sqlite3": "9.4.3",
"better-sqlite3": "11.3.0",
"lodash": "4.17.21",
"mysql2": "3.9.4",
"passport-google-oauth2": "0.2.0",
Expand All @@ -28,7 +28,7 @@
"styled-components": "6.1.8"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/todo-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@strapi/strapi": "workspace:*"
},
"engines": {
"node": ">=12.x.x <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"isStrapiMonorepo": true
Expand Down
Loading

0 comments on commit 51d9cfe

Please sign in to comment.