Build/Test Tools: Raise minimum required version of Node.js/npm.

This bumps the minimum required version of Node.js/npm from 16.19.1 and 8.19.3 to 20.10.0 and 10.2.3.

Since 20.10.0 is the latest 20.x version of Node.js, the `check-latest` option has been enabled for `actions/setup-node` in GitHub Actions workflows. This performs an additional external call to the Node.js API confirming the latest version is installed on the runner for use. In testing, it seems that 20.10.0 was not consistently deployed to all runner machines in use. This should be removed in the near future when the version of Node.js is reliably above the new minimum requirement.

The Gutenberg repository has also been updated to use the same values for `engines`.

Props jorbin, joemcgill, swissspidy, benharri, dhrupo, flootr, gziolo, noahtallen.
See #59663.

git-svn-id: https://develop.svn.wordpress.org/trunk@57212 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2023-12-20 18:44:57 +00:00
parent c6773eeffd
commit d522886b27
7 changed files with 22 additions and 6 deletions

View File

@ -49,6 +49,7 @@ jobs:
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
- name: Log debug information

View File

@ -57,6 +57,7 @@ jobs:
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
cache-dependency-path: |
package-lock.json

View File

@ -71,12 +71,14 @@ jobs:
# - Run performance tests (current commit).
# - Print performance tests results.
# - Check out target commit (target branch or previous commit).
# - Switch Node.js versions if necessary.
# - Install npm dependencies.
# - Build WordPress.
# - Run any database upgrades.
# - Run performance tests (previous/target commit).
# - Print target performance tests results.
# - Reset to original commit.
# - Switch Node.js versions if necessary.
# - Install npm dependencies.
# - Set the environment to the baseline version.
# - Run any database upgrades.
@ -190,6 +192,12 @@ jobs:
fi
git reset --hard $TARGET_SHA
- name: Set up Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install npm dependencies
run: npm ci
@ -212,6 +220,12 @@ jobs:
- name: Reset to original commit
run: git reset --hard $GITHUB_SHA
- name: Set up Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install npm dependencies
run: npm ci

2
.nvmrc
View File

@ -1 +1 @@
16
20

View File

@ -35,7 +35,7 @@ You will need Node and npm installed on your computer. Node is a JavaScript runt
If you are not using a package manager, see the [Node.js download page](https://nodejs.org/en/download/) for installers and binaries.
**Note:** WordPress currently only officially supports Node.js `16.x` and npm `8.x`.
**Note:** WordPress currently only officially supports Node.js `20.x` and npm `10.x`.
You will also need [Docker](https://www.docker.com/products/docker-desktop) installed and running on your computer. Docker is the virtualization software that powers the local development environment. Docker can be installed just like any other regular application.

4
package-lock.json generated
View File

@ -158,8 +158,8 @@
"webpack-livereload-plugin": "3.0.2"
},
"engines": {
"node": ">=16.19.1",
"npm": ">=8.19.3 <9"
"node": ">=20.10.0",
"npm": ">=10.2.3"
}
},
"node_modules/@aashutoshrathi/word-wrap": {

View File

@ -7,8 +7,8 @@
"url": "https://develop.svn.wordpress.org/trunk"
},
"engines": {
"node": ">=16.19.1",
"npm": ">=8.19.3 <9"
"node": ">=20.10.0",
"npm": ">=10.2.3"
},
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",