Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ runs:
node-version-file: ${{ inputs.node-version == '' && '.nvmrc' || '' }}
node-version: ${{ inputs.node-version }}
check-latest: true
cache: npm
# Caching for npm dependencies is automatically enabled when package.json contains devEngines.packageManager field set to npm
# cache: npm
cache-dependency-path: |
package-lock.json
patches/**

- name: Pin npm version for consistency
run: |
npm install --global npm@10
npm --version
Comment thread
manzoorwanijk marked this conversation as resolved.
shell: bash

- name: Get Node.js and npm version
id: node-version
Expand All @@ -26,7 +36,16 @@ runs:
id: cache-node_modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: '**/node_modules'
# List workspace node_modules explicitly to support all kinds of layouts - hoisted and isolated.
# A '**/node_modules' glob follows the isolated layout's symlinks and stalls the cache step.
path: |
node_modules
packages/*/node_modules
routes/*/node_modules
storybook/node_modules
test/*/node_modules
tools/*/node_modules
widgets/*/node_modules
key: node_modules-${{ runner.os }}-${{ runner.arch }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json', 'patches/**') }}

- name: Install npm dependencies
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ jobs:
node-version-file: '.nvmrc'
check-latest: true

- name: Pin npm version for consistency
run: |
npm install --global npm@10
npm --version

- name: Configure build for wordpress-develop
if: ${{ ! matrix.IS_GUTENBERG_PLUGIN }}
run: jq --tab '.wpPlugin.name = "wp"' package.json > package.json.tmp && mv package.json.tmp package.json
Expand Down Expand Up @@ -564,6 +569,11 @@ jobs:
registry-url: 'https://registry.npmjs.org'
check-latest: true

- name: Pin npm version for consistency
run: |
npm install --global npm@10
npm --version

- name: Publish packages to npm ("latest" dist-tag)
run: |
cd main
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ jobs:
check-latest: true
cache: npm

- name: Pin npm version for consistency
run: |
npm install --global npm@10
npm --version

- uses: preactjs/compressed-size-action@f322c295dde06a1cb7ccaef105732dd8a726d1d9 # v2.10.0
with:
omit-unchanged: true
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish-npm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ jobs:
registry-url: 'https://registry.npmjs.org'
check-latest: true

- name: Pin npm version for consistency
run: |
npm install --global npm@10
npm --version

- name: Publish development packages to npm ("next" dist-tag)
if: ${{ github.event.inputs.release_type == 'development' }}
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
cache: npm

- name: Pin npm version for consistency
run: npm install -g npm@10
run: |
npm install --global npm@10
npm --version

- name: npm install
# A "full" install is executed, since `npm ci` does not always exit
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
"node": ">=20.19.0",
"npm": ">=10.2.3"
},
"devEngines": {
"runtime": {
"name": "node",
"version": ">=20.19.0"
},
"packageManager": {
"name": "npm",
"version": ">=10.2.3"
Comment on lines +26 to +28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this, >=10.2.3 accepts newer npm majors when the runtime is compatible, while every new CI step uses the floating npm@10 selector.

Looking at the current Node 24 job, that selector installed 10.9.8; a contributor using npm 11 still satisfies this devEngines range. That preserves the version mismatch behind #72143, and a future npm 10 release can also change CI without any repository change.

So I feel that this PR's claim is not fully satisfied. If we merge as-is, we should leave #72143 open for the actual version-alignment follow-up. Otherwise, we could select one exact npm version in devEngines.packageManager.version ? The broader engines.npm range can remain for the build server if needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is intentional. We don't want to lock everyone with the old npm version if the latest one works fine. For example, currently, I am on npm v11 although the engines mention v10.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR to avoid closing the related issue.

}
},
"wpPlugin": {
"name": "gutenberg",
"scriptGlobal": "wp",
Expand Down
4 changes: 2 additions & 2 deletions tools/release/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ async function runPerformanceTests( branches, options ) {

logAtIndent( 2, 'Installing dependencies and building' );
await runShellScript(
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && npm ci && npm run build --workspace @wordpress/e2e-test-utils-playwright && npx playwright install chromium --with-deps"`,
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && npm install --global npm@10 && npm ci && npm run build --workspace @wordpress/e2e-test-utils-playwright && npx playwright install chromium --with-deps"`,
testRunnerDir
);

Expand Down Expand Up @@ -403,7 +403,7 @@ async function runPerformanceTests( branches, options ) {

logAtIndent( 3, 'Installing dependencies and building' );
await runShellScript(
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && npm ci && (npm run build -- --skip-types || npm run build)"`,
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && npm install --global npm@10 && npm ci && (npm run build -- --skip-types || npm run build)"`,
buildDir
);

Expand Down
Loading