Skip to content

Commit b5e438a

Browse files
committed
Framework: Update npm to v12
Bump engines.npm and devEngines.packageManager to npm v12, now that the supply chain policy the major requires has landed in #82689. npm v12 does not exempt workspace lifecycle scripts from allowScripts under install-strategy=linked, so @wordpress/icons needs an entry of its own to keep generating src/library on install, keyed by its file: spec rather than its name. See npm/cli#9982. Drop lockfile-version, which the lockfile already records: pinning it to 3 only fought the version 4 that .npm-extension.mjs and npm patch force. Closes #82328.
1 parent bf41207 commit b5e438a

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎.npmrc‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ install-strategy = "linked"
22
engine-strict = true
33
strict-peer-deps = true
44
prefer-dedupe = true
5-
lockfile-version = 3
65
min-release-age = 1
76
# fail the install on any dependency script not covered by allowScripts in package.json
87
strict-allow-scripts = true

‎docs/contributors/code/getting-started-with-code-contribution.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ The following guide is for setting up your local environment to contribute to th
55
## Prerequisites
66

77
- Node.js
8-
Gutenberg is a JavaScript project that requires [Node.js](https://nodejs.org/). The project is currently built using Node.js v24 and npm v11. Though best efforts are made to always use the Active LTS version of Node.js, this will not always be the case. For more details, please refer to the [Node.js release schedule](https://github.com/nodejs/Release#release-schedule).
8+
Gutenberg is a JavaScript project that requires [Node.js](https://nodejs.org/). The project is currently built using Node.js v24 and npm v12. Though best efforts are made to always use the Active LTS version of Node.js, this will not always be the case. For more details, please refer to the [Node.js release schedule](https://github.com/nodejs/Release#release-schedule).
99

1010
We recommend using the [Node Version Manager](https://github.com/nvm-sh/nvm) (nvm) since it is the easiest way to install and manage node for macOS, Linux, and Windows 10 using WSL2. See [our Development Tools guide](/docs/getting-started/devenv/README.md#node-js-development-tools) or the Nodejs site for additional installation instructions.
1111

12+
- npm
13+
Install npm explicitly rather than relying on the version Node.js bundles:
14+
15+
```bash
16+
npm install --global npm@^12
17+
```
18+
1219
- Git
1320
Gutenberg is using git for source control. Make sure you have an updated version of git installed on your computer, as well as a GitHub account. You can read the [Git Workflow](/docs/contributors/code/git-workflow.md) to learn more about using git and GitHub with Gutenberg
1421

‎docs/contributors/code/managing-packages.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The repository also contains internal workspaces under `tools/` and `test/` for
1616

1717
Install scripts are opt-in: every dependency that ships one is recorded in `allowScripts` in the root `package.json`, and `strict-allow-scripts` fails the install with `ESTRICTALLOWSCRIPTS` on anything missing from that list. Every entry is `false`, so nothing compiles on install. `test/ai-development` installs with `--prefix`, so it carries its own copy of the policy.
1818

19-
`allowScripts` covers dependencies only, so workspace lifecycle scripts such as the `@wordpress/icons` `prepare` still run. npm v12 skips them under `install-strategy=linked` with no error ([npm/cli#9982](https://github.com/npm/cli/issues/9982)), so moving to npm v12 means invoking them from the root `postinstall` instead.
19+
`allowScripts` covers dependencies only on npm v11, so workspace lifecycle scripts such as the `@wordpress/icons` `prepare` ran unguarded. npm v12 holds them to the same policy under `install-strategy=linked`, and skips an unlisted one with no error ([npm/cli#9982](https://github.com/npm/cli/issues/9982)), so a workspace that needs its script is approved by its `file:` spec rather than its name: `"file:packages/icons": true`.
2020

2121
When an install fails that way, read the script, then edit `allowScripts` by hand and commit the `package.json` change. Use the package name on its own to cover every version, or `name@version` to pin an approval to the version you reviewed:
2222

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"engines": {
1818
"node": ">=24.18.0",
19-
"npm": ">=11.18.0"
19+
"npm": ">=12.0.2"
2020
},
2121
"devEngines": {
2222
"runtime": {
@@ -25,7 +25,7 @@
2525
},
2626
"packageManager": {
2727
"name": "npm",
28-
"version": ">=11.18.0",
28+
"version": ">=12.0.2",
2929
"onFail": "error"
3030
}
3131
},
@@ -241,6 +241,7 @@
241241
"core-js": false,
242242
"core-js-pure": false,
243243
"esbuild": false,
244+
"file:packages/icons": true,
244245
"fs-ext-extra-prebuilt": false,
245246
"fsevents": false,
246247
"nx": false,

0 commit comments

Comments
 (0)