ci: pin npm 11 so dep bumps stop desyncing the lockfile - #48
Merged
Merged
Conversation
Node 22 bundles npm 10.9.x, but this repo is developed on npm 11, and the two disagree on lockfile shape: npm 11 prunes entries (utf-8-validate@5.0.10 and friends) that npm 10 then reports as `Missing from lock file` and refuses to `npm ci`. Every dependency bump therefore had to have its lockfile regenerated with `npx npm@10` or CI failed — 5b1728b did exactly that for the 0.0.92 bump, and #46 hit it again for 0.0.94. Pin npm 11.13.0 in both jobs, declare it via packageManager + engines, and regenerate package-lock.json with npm 11 so the committed lockfile is the shape CI actually installs. Same fix this library's consumers already carry: pubsub-voting-testing-on-real-website dfc1b7f (packageManager + engines + Netlify NPM_VERSION) and pkc-js 516431d98 (the release job). release.yml is pinned too, not just ci.yml: release-it's before:git:release hook runs `npm i --package-lock-only`, so the release bot rewrites the lockfile with whatever npm it has. Pinning only CI would mean every release re-broke master. Verified locally on npm 11.13.0: npm ci, typecheck, typecheck:examples, typecheck:tests, build, 509 unit tests, 12 integration tests — all pass. And `npx npm@10 ci --dry-run` now fails with the EUSAGE/Missing error, confirming the pin is load-bearing rather than decorative.
|
Warning Review limit reachedNext included review available in 16 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
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. Comment |
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.
Every dependency bump in this repo has to have its lockfile regenerated with
npx npm@10or CI fails. 5b1728b did exactly that for the 0.0.92 bump; #46 hit it again for 0.0.94. This retires the workaround.The problem
Node 22 bundles npm 10.9.x, but the repo is developed on npm 11, and the two disagree on lockfile shape. npm 11 prunes entries (
utf-8-validate@5.0.10and friends) that npm 10 then reports asMissing from lock fileand refuses to install:So a lockfile regenerated on any dev machine breaks CI, and the only workaround is remembering to shell out to an npm you don't otherwise use.
The fix
npm i -g npm@11.13.0in both jobs, immediately aftersetup-nodeand beforenpm cipackageManager: "npm@11.13.0"+engines.npm: ">=11"so the requirement is declared, not just enforced in CIpackage-lock.jsonregenerated with npm 11, so the committed lockfile is the shape CI actually installsSame fix this library's consumers already carry — pubsub-voting-testing-on-real-website
dfc1b7f(packageManager + engines + NetlifyNPM_VERSION) and pkc-js516431d98(the release job).Why
release.ymltoo, not justci.ymlrelease-it's
before:git:releasehook runsnpm i --package-lock-only(seeconfig/.release-it.json), so the release bot rewrites the lockfile with whatever npm it has. Pinning only CI would mean every release silently re-broke master — which is precisely the failure pkc-js516431d98was written to stop.Verification
On npm 11.13.0, everything CI runs passes:
npm ci,typecheck,typecheck:examples,typecheck:tests,build, 509 unit tests, 12 integration tests.And the pin is load-bearing rather than decorative —
npx npm@10 ci --dry-runagainst this branch now fails with the EUSAGE/Missing: utf-8-validateerror. Without the workflow change, this lockfile would break CI; with it, both agree.