Repository navigation
Conversation
Includes an upgrade to `simple-git` v2.35.0, which allows us to retain our progress meter. Co-authored-by: Noah Allen <noahtallen@gmail.com> (cherry picked from commit d7f3337)
(cherry picked from commit 1cacd5e)
… does not need to prepare. npm 11 runs the git dependency's prepare script, which fails to build it with the newer Babel parser npm 11 installs for it. The tarball of the same commit needs no prepare. Only the native editor uses the package, through its src entry point.
webpack 4 and @wordpress/dependency-extraction-webpack-plugin hash with md4, which OpenSSL 3 disables. wp-scripts starts webpack and Jest's runner as separate processes, so build, dev and test-unit set NODE_OPTIONS through cross-env, and bin/test-create-block.sh exports it.
Upgrade to supports npm 7. See the changelog [here](https://github.blog/2021-02-02-npm-7-is-now-generally-available/). This fixes an error when running `npm install` with npm 7: ``` Error: ENOTDIR: not a directory, scandir '/gutenberg/node_modules/.package-lock.json' at Object.readdirSync (fs.js:1021:3) at /gutenberg/patches/patch-xcode.js:21:21 at Array.forEach (<anonymous>) at fetchRNPackageDirs (/gutenberg/patches/patch-xcode.js:16:10) at Object.<anonymous> (/gutenberg/patches/patch-xcode.js:37:29) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) { errno: -20, syscall: 'scandir', code: 'ENOTDIR', path: '/gutenberg/node_modules/.package-lock.json' } ``` The error is because, in `patches/patch-xcode`, we were assuming every file in the `node_modules` directory is a directory. Which apparently changes now that it also consists a `.package-lock.json` file. This PR also upgrades the version of the lock file format to version 2, which should also be backward-compatible to npm 6 users. (cherry picked from commit 2b55fce)
npm 11 rejects the version 1 lockfile: its entries for GitHub-hosted dependencies do not satisfy package.json, and it lacks the simple-git 2 that wp-env now uses. simple-git is held at 2.35.0, the version the simple-git change locked on trunk. No other dependency changes version apart from simple-git's own dependencies. legacy-peer-deps keeps npm 6's peer dependency handling, which the tree relies on.
A version 3 lockfile has no dependencies section. Same change as #53426 made on trunk.
packages/data/src/test/registry.js leaves a promise rejected. Node.js 15 and later end the process on an unhandled rejection, which ends the Jest worker and fails the suite; --unhandled-rejections=warn restores Node.js 14's behavior.
…h npm 11 does not need to prepare." This reverts commit 09e18ca.
…ommit npm 11 runs a git dependency's prepare script, and react-native-svg's fails to build it with the newer Babel parser npm 11 installs for it. A tarball needs no prepare; trunk moved the native editor's forked dependencies to tarballs in #34886. The fork has no committed tarball for this commit, so this uses GitHub's archive of it.
…spec npm install --package-lock-only --lockfile-version 3 with npm 11. Only the react-native-svg range recorded for packages/react-native-editor changes; the installed react-native-svg entry, its resolved URL and integrity are unchanged.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
npm 9 removed `npm bin`, so `$( npm bin )/wp-scripts` runs as `Unknown: command not found` under npm 11 and every end-to-end job exits with code 127. The wp/5.4 end-to-end workflow already calls ./node_modules/.bin/wp-scripts.
Same form as #53426 used on trunk to replace `$( npm bin )`, which npm 9 removed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Sets
.nvmrcto Node.js 24.20 onwp/5.7, as on trunk, and makes the branch install, build, lint and run its unit tests with Node.js 24 and npm 11.Why?
The wordpress-develop 5.7 branch moves to Node.js 24 in WordPress/wordpress-develop#15703. This branch's CI takes Node.js from
.nvmrc, and with only that changenpm cifails on Node.js 24 and npm 11.How?
.nvmrcis 24.20.wp-envclones, fetches (with--tags) and checks out git sources withsimple-gitinstead of NodeGit, which does not build on Node.js 24.packages/envdepends onsimple-git^2.35.0in place ofnodegit, the rootsimple-gitdevDependency moves from 1.113.0 to^2.35.0,bin/plugin/lib/git.jsloadssimple-gitinstead ofsimple-git/promiseand gets// @ts-nocheck, andpackages/env/CHANGELOG.mdgets the backported breaking change entry.patches/patch-xcode.js, which thepostinstallscript runs, reads only directories innode_modules. npm 7 and later write anode_modules/.package-lock.jsonfile there, and the script stopped on it withENOTDIR, so every install failed.packages/react-native-editor/package.jsoninstallsreact-native-svgfrom GitHub's tarball of the same commit (https://codeload.github.com/wordpress-mobile/react-native-svg/tar.gz/a628e92990a2404e30a0086f168bd2b5b7b4ce96) instead of from git, as [RNMobile] Use tarball instead of git tag for react-native-editor forked dependencies #34886 did on trunk for the native editor's forked dependencies. npm 11 runs a git dependency'spreparescript, and react-native-svg's Babel build fails under npm 11; a tarball needs noprepare. Only the native editor uses the package..npmrcsetslegacy-peer-deps = true, which keeps npm 6's peer dependency handling.buildanddevrunwp-scriptswithcross-env NODE_OPTIONS=--openssl-legacy-provider, andbin/test-create-block.shexports the sameNODE_OPTIONS: webpack 4 and@wordpress/dependency-extraction-webpack-pluginhash with md4, which OpenSSL 3 disables.test-unitsetsNODE_OPTIONS="--openssl-legacy-provider --unhandled-rejections=warn".packages/data/src/test/registry.jsleaves a promise rejected, which ends the Jest worker on Node.js 15 and later. Node.js 14 only warned.bin/validate-package-lock.jsreads the lockfile'spackagessection instead ofdependencies, which lockfile version 3 does not have, as minimal node and npm upgrade #53426 did on trunk..github/workflows/end2end-test.ymlrunsnpx wp-scripts test-e2einstead of$( npm bin )/wp-scripts test-e2e, as minimal node and npm upgrade #53426 did on trunk: npm 9 removednpm bin, so every end-to-end job exited before running a test.package-lock.jsonfrom lockfile version 1 to 3 with npm 11. Installed versions change only through the changes above:simple-gitmoves from 1.113.0 to 2.35.0, the version wp-env: Use Simple Git instead of NodeGit #28848 locked, and its nesteddebugandmsfrom 4.1.1 and 2.1.1 to 4.4.3 and 2.1.3;@kwsites/file-exists1.1.1 (with a nesteddebug4.4.3 andms2.1.3) and@kwsites/promise-deferred1.1.1 are added;nodegit0.27.0 and the packages only it used are removed.react-native-svgstays at 9.13.6-gb, resolved from the tarball. 53 entries that no package requires are dropped.Testing Instructions
With Node.js 24 and npm 11:
npm ci && npm run build && npm run lint && npm run test-unit.The build output is byte-identical to a Node.js 14 build of
wp/5.7, and the unit test andnpm run test:create-blockresults are the same.Use of AI Tools
AI assistance: Yes
Tools: Claude Code
Model: Claude Opus 5.5
Used for: Backporting the three PRs, applying the changes, regenerating the lockfile, building and testing on Node.js 14 and 24 and comparing the output, and drafting this description.