Skip to content

fix(npm): leave dev-only entries out of the shipped shrinkwrap - #96

Merged
oscardvs merged 1 commit into
mainfrom
fix/shrinkwrap-omit-dev
Sep 27, 2026
Merged

oscardvs merged 1 commit into
mainfrom
fix/shrinkwrap-omit-dev

Conversation

@oscardvs

Copy link
Copy Markdown
Owner

1.22.1 shipped package-lock.json whole as npm-shrinkwrap.json. npm installs every entry a dependency's shrinkwrap lists, dev or not. So the first npx @oscardvs/zoteus@1.22.1 fetched vitest, typescript, esbuild, eslint and the rest with the server: 278 packages and 228 MB. A 1.22.0-style install is about 100 packages and 104 MB.

scripts/shrinkwrap.mjs now writes the lock without the entries flagged dev and without the root's devDependencies.

Verification. npm ci in a consumer whose lock marks the package hasShrinkwrap: true, which is the reify path a registry install takes. A plain local-tarball install never honours a shrinkwrap.

  • The published 1.22.1 tarball reproduces 278 packages and 228 MB, with the dev tools on disk.
  • The pruned tarball installs 99 packages, 132 MB on Linux. All 98 on-disk packages match the locked versions, and there are no dev tools.

The remaining difference against 1.22.0 on Linux is that npm installs both the glibc and the musl canvas binary: npm 10's lockfile records no libc. The repository's own npm ci does the same, and on macOS and Windows the cpu field already picks one binary.

Checks. A new test in tests/claude-plugin.test.ts checks that the shipped file holds exactly the lock's runtime entries (19 tests). typecheck:tests and eslint are clean. A 1.22.2 release follows, to move the plugin pin off 1.22.1.

1.22.1 shipped package-lock.json whole as npm-shrinkwrap.json. npm installs
every entry a dependency's shrinkwrap lists, dev or not, so the first
`npx @oscardvs/zoteus@1.22.1` fetched vitest, typescript, esbuild, eslint and the
rest with the server: 278 packages and 228 MB.

scripts/shrinkwrap.mjs now writes the lock without the entries flagged dev and
without the root's devDependencies. It was checked through npm ci, with a
consumer lock that marks the package hasShrinkwrap (the path a registry install
takes). The published 1.22.1 reproduces 278 packages and 228 MB there. The
pruned file installs 99 packages and 132 MB on Linux, every one at its locked
version, with no dev tools. A test checks that the shipped file holds exactly
the lock's runtime entries.
@oscardvs
oscardvs merged commit 03f2f1c into main Sep 27, 2026
2 checks passed
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.

1 participant