Skip to content

Fix: build-npx-tarball.cjs skips prepare-pack - #477

Merged
debugmcpdev merged 4 commits into
debugmcp:mainfrom
abhijeetnardele24-hash:fix/issue-463-tarball-prepare-pack
Aug 24, 2026
Merged

Fix: build-npx-tarball.cjs skips prepare-pack#477
debugmcpdev merged 4 commits into
debugmcp:mainfrom
abhijeetnardele24-hash:fix/issue-463-tarball-prepare-pack

Conversation

@abhijeetnardele24-hash

Copy link
Copy Markdown
Contributor

Closes #463. Wraps the pack command in build-npx-tarball.cjs with prepare-pack prepare and restore so the tarball contains correct package version specifiers.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…on the packed manifest

Two hardening amendments on top of the prepare/restore wrapping:

- run() exits the process on failure, which silently skips a `finally` —
  spawn the pack directly so the original package.json is restored even
  when npm pack fails, then propagate the exit code.
- After extraction, fail the build if the packed package.json still
  contains workspace: specifiers, so this path can never regress to
  shipping an un-installable tarball again (the assertion the issue
  asked for).

Verified end to end: dist-tarball/mcp-debugger-latest.tgz now carries
real versions in optionalDependencies (1.11.8, zero workspace: refs),
npm install of the tarball succeeds in an isolated directory, and the
installed CLI runs (--version → 0.24.2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@debugmcpdev

Copy link
Copy Markdown
Collaborator

This one is exactly right — clean branch, single concern, and the prepare/restore wrapping matches what the issue called for. Thank you, this is release-blocking for 0.25.0 so the turnaround is much appreciated.

I pushed one hardening commit to your branch (ea804a4) rather than round-tripping, since we're bundling for the release:

  1. run() calls process.exit on failure, which skips finally — so a failed npm pack would have left packages/mcp-debugger/package.json in its rewritten state (and the next prepare would then back up the wrong file). The pack is now spawned directly and restore runs on both paths.
  2. Added the regression guard the issue asked for: after extraction, the build fails if the packed manifest still contains workspace: specifiers — so this path can't silently regress again.

Verified end to end on your branch: the packed optionalDependencies now carry real versions (1.11.8), npm install <tarball> succeeds in an isolated directory (previously EUNSUPPORTEDPROTOCOL), and the installed CLI runs. Will merge once CI is green.

Also: this branch is exactly the shape we want PRs in — no lockfile churn, no unrelated commits. If you bring #474 and #475 to the same shape per the reviews there, those can land too.

@debugmcpdev debugmcpdev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified end to end (see comment): packed manifest carries real versions, tarball npm-installs in isolation, CLI runs. Hardening commit adds restore-on-failure and the workspace: regression guard.

@debugmcpdev
debugmcpdev merged commit f122925 into debugmcp:main Aug 24, 2026
10 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.

build-npx-tarball.cjs skips prepare-pack — dist-tarball ships workspace:* and cannot be npm install'ed

3 participants