Tools: Remove save-exact from .npmrc#78196
Conversation
`save-exact = true` made `npm install <pkg>` write pinned versions, which predates Gutenberg publishing libraries as `@wordpress/*` packages. Exact versions in published packages block downstream consumers from receiving SemVer-compatible patch and security updates for transitive deps.
|
Flaky tests detected in 5602aaa. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25729695069
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Removes
save-exact = truefrom.npmrcso thatnpm install <pkg>writes caret (^x.y.z) ranges instead of exact (x.y.z) versions.Follow up to #77950.
Why?
save-exact = truewas added 8 years ago in #2512 by @aduth, when Gutenberg was primarily an application (before the monorepo packages publishing pattern was adopted in #6658). The original rationale was:Since Gutenberg now publishes ~100 npm libraries under
@wordpress/*, the original logic actually argues against pinning. Exact versions in published packages prevent downstream consumers from receiving SemVer-compatible security and patch updates for transitive dependencies. @aduth confirmed this view in the #77950 discussion:In addition, #77950 introduces Syncpack with a
range: '^'rule forprod/devdependencies. As @ciampo flagged, leavingsave-exact = truein.npmrcwould mean everynpm install <pkg>writes an exact version that Syncpack then immediately flags as aSemverRangeMismatch. Removing it here aligns the install behaviour with the lint policy so the two stop fighting.The drift-prevention role that
save-exactused to play is now better covered by:package-lock.json(committed) — guarantees identical installs across machines and CI.lint:lockfile— catches lockfile inconsistencies.How?
.npmrc— remove thesave-exact = trueline. The remaining options (engine-strict,legacy-peer-deps,prefer-dedupe,lockfile-version,min-release-age) are unaffected.No existing declared versions are rewritten in this PR — that realignment happens through Syncpack in the follow-up to #77950. This change only affects how future
npm install <pkg>invocations record versions inpackage.json.Testing Instructions
Testing Instructions for Keyboard
N/A — no UI changes.
Screenshots or screencast
N/A — tooling/config only.
Use of AI Tools
Drafted with assistance from Claude Code. The change, rationale, and PR description were reviewed and edited by hand.