Repository navigation
chore: fail the publish workflow on lockfile version drift - #3
Merged
Merged
Conversation
`npm ci` already fails when package-lock.json's DEPENDENCY entries disagree with package.json. It does not check the lockfile's copy of this project's own version — the field a release bumps in package.json while running no install. Nothing caught that: measured in bareguard, where the lockfile sat at 0.13.0 while 0.14.0, 0.15.0 and 0.16.0 all shipped. Adds `scripts/check-lockfile.mjs` / `npm run check:lockfile`, comparing both places npm writes the version (the lockfile root and `packages[""]`), wired into the publish workflow via `--if-present` beside the existing Typecheck step. A missing lockfile exits 0 — some repos deliberately ship without one and this step is shared across all of them. Harmless to consumers: npm does not include a library's lockfile in the published tarball. This is repo hygiene, and a hard failure only because it is trivially fixable and compares two numbers this repo owns. Propagated from bareguard along with the canonical PUBLISH_TEMPLATE.yml. Branch pushed only — not merged, no version bump, no publish. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
package-lock.jsoncarries its own copy of the project version, and/releasebumps
package.jsonwithout running an install — so the lockfile's versionsilently falls behind, sometimes by several minors.
npm cidoes not catch this:it only compares dependency entries, never the project's own version field.
Harmless to consumers (npm does not ship a library's lockfile in the tarball),
but it is drift, and it is invisible.
This adds a
Lockfile version matches package.jsonstep topublish.yml,running
npm run check:lockfile --if-present. The--if-presentisload-bearing: a repo without the script no-ops instead of failing.
CHANGELOG updated. No version bump, no publish.
🤖 Generated with Claude Code