Skip to content

[NOT READY YET] Build/Test Tools: Upgrade npm to v12 - #13536

Draft
manzoorwanijk wants to merge 8 commits into
WordPress:trunkfrom
manzoorwanijk:update/npm-12
Draft

manzoorwanijk wants to merge 8 commits into
WordPress:trunkfrom
manzoorwanijk:update/npm-12

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Sep 15, 2026

Copy link
Copy Markdown
Member

Upgrades npm to v12 for Core and the bundled themes with a build process, mirroring WordPress/gutenberg#82732. npm v12 makes dependency install scripts, git dependencies and remote URL dependencies opt-in.

Temporary test PR: it includes the commits from #13505 so CI runs npm v12. It will be rebased on trunk once #13505 lands.

  • devEngines and engines require npm >=12.0.2 in Core, Twenty Twenty-One, Twenty Twenty-Two and Twenty Twenty-Five.
  • allowScripts denies every install script except the three below, and strict-allow-scripts fails the install on unreviewed ones.
  • test-and-zip-default-themes.yml now uses the setup-npm action.

Approved install scripts

gifsicle, jpegtran-bin and optipng-bin are approved because grunt precommit:image fails with ENOENT without the binaries they fetch.

Next steps

  • Replace grunt-contrib-imagemin, unmaintained since 2022, or drop precommit:image.
  • Deny the three packages afterwards.

Trac ticket:

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Implementation and this description, reviewed by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Install the npm version required by `devEngines.packageManager`, keeping the bundled npm when the field is absent. Restore the npm download cache with `actions/cache`, since `actions/setup-node` resolves it with the bundled npm.

Mirrors the Gutenberg action from WordPress/gutenberg#82775 and WordPress/gutenberg#82823.

See #66099.
…ction.

Disable npm caching in `actions/setup-node` and run `setup-npm` before installing dependencies. Skip the action on release branches that run these workflows from `trunk` without it.

Run the calling workflows when the action changes.

See #66099.
Declare the same Node.js and npm requirements as Gutenberg, so CI installs the required npm version.

See #66099.
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@manzoorwanijk manzoorwanijk changed the title Build/Test Tools: Upgrade npm to v12 [NOT READY YET] Build/Test Tools: Upgrade npm to v12 Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants