Skip to content

fix: publish a runtime-only npm shrinkwrap - #83

Merged
abruption merged 1 commit into
mainfrom
fix/production-only-shrinkwrap
Sep 29, 2026
Merged

abruption merged 1 commit into
mainfrom
fix/production-only-shrinkwrap

Conversation

@abruption

Copy link
Copy Markdown
Owner

Summary

[email protected] published the repository lockfile as npm-shrinkwrap.json, including every development dependency. npm installs every entry of a dependency's shrinkwrap, so npm install [email protected] added 105 packages (typescript, eslint, ajv, ... as extraneous) instead of 3. Global installs were unaffected.

  • Restore package-lock.json as the repository lockfile (rename only; the tree is unchanged).
  • Add scripts/consumer-shrinkwrap.mjs, which generates npm-shrinkwrap.json from package-lock.json with only the runtime tree: entries marked dev/devOptional and the root devDependencies are removed. --check verifies an existing file.
  • The publish job runs the generator after the tests and package smoke, immediately before npm publish. prepublishOnly runs --check, so publication fails if the shrinkwrap is missing, stale, or contains development entries.
  • npm-shrinkwrap.json is git-ignored so a generated copy never overrides package-lock.json for local installs.
  • Package smoke generates the shrinkwrap for packing and removes or restores it afterwards. It asserts that the shrinkwrap contains only fs-ext-extra-prebuilt and nan, and it now installs the packed artifact as a regular dependency (previously --omit=dev, which hid this regression). That installation must contain exactly codex-unlock, fs-ext-extra-prebuilt, and nan.
  • Update AGENTS.md, docs/maintainer-release.md, docs/platform-support.md, and the Dependabot comment.

Closes #82

Type

  • fix

Safety impact

Packaging only. No change to lock probing, owner validation, signaling, or JSON output. Runtime pins for npm consumers are unchanged (fs-ext-extra-prebuilt 2.2.14, nan 2.29.0).

Checklist

  • npm run check passes
  • npm run lint passes
  • npm test passes (164 pass, 0 fail)
  • npm run smoke:package passes
  • Commits follow Conventional Commits
  • Documentation is updated when behavior or output changed
  • No tokens, private paths, or unredacted process data are in the diff

Notes

  • npm publish --dry-run runs the prepublishOnly check and packs a 1.2 kB shrinkwrap with only the two runtime entries.
  • node scripts/consumer-shrinkwrap.mjs --check fails without a generated file, and assertConsumerShrinkwrap rejects the full lockfile.
  • npm ci, smoke:platform, and a clean working tree after package smoke were verified locally.
  • Release Please's node strategy updates package-lock.json, so version bumps need no configuration change.

codex-unlock 0.4.1 published the repository lockfile as npm-shrinkwrap.json,
including every development dependency. npm installs every entry of a
dependency's shrinkwrap, so installing codex-unlock as a dependency added
about 100 development packages under node_modules/codex-unlock.

Restore package-lock.json as the repository lockfile and generate the
published npm-shrinkwrap.json from it with only the runtime tree
(scripts/consumer-shrinkwrap.mjs). The publish job generates it before
npm publish, prepublishOnly rejects a missing, stale, or development-bearing
shrinkwrap, and the generated file is git-ignored so it never overrides
package-lock.json for local installs.

Package smoke now installs the packed artifact as a regular dependency and
requires exactly codex-unlock, fs-ext-extra-prebuilt, and nan.

Closes #82
@abruption abruption added this to the v0.4.2 milestone Sep 29, 2026
@abruption
abruption merged commit d279732 into main Sep 29, 2026
23 checks passed
@abruption
abruption deleted the fix/production-only-shrinkwrap branch September 29, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: published npm-shrinkwrap.json installs development dependencies for dependency consumers

1 participant