From d522886b27ce8b8a6b9471b53e15360525b0b006 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 20 Dec 2023 18:44:57 +0000 Subject: [PATCH] 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 --- .../workflows/callable-test-core-build-process.yml | 1 + .../callable-test-gutenberg-build-process.yml | 1 + .github/workflows/performance.yml | 14 ++++++++++++++ .nvmrc | 2 +- README.md | 2 +- package-lock.json | 4 ++-- package.json | 4 ++-- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/callable-test-core-build-process.yml b/.github/workflows/callable-test-core-build-process.yml index c1acb04acf..a9523ec343 100644 --- a/.github/workflows/callable-test-core-build-process.yml +++ b/.github/workflows/callable-test-core-build-process.yml @@ -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 diff --git a/.github/workflows/callable-test-gutenberg-build-process.yml b/.github/workflows/callable-test-gutenberg-build-process.yml index 1c2ab24f98..ef41cff56e 100644 --- a/.github/workflows/callable-test-gutenberg-build-process.yml +++ b/.github/workflows/callable-test-gutenberg-build-process.yml @@ -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 diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index c3e629367f..356d5f7724 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -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 diff --git a/.nvmrc b/.nvmrc index b6a7d89c68..209e3ef4b6 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +20 diff --git a/README.md b/README.md index 8e7411241f..9af956b28e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/package-lock.json b/package-lock.json index 573ea49ed2..0c83ac3d13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index 7177b30865..3dc447fcb3 100644 --- a/package.json +++ b/package.json @@ -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",