Skip to content

fix(pm): accept positional package names for vp rebuild#1564

Open
fengmk2 wants to merge 3 commits into
mainfrom
fix/rebuild-accept-package-args
Open

fix(pm): accept positional package names for vp rebuild#1564
fengmk2 wants to merge 3 commits into
mainfrom
fix/rebuild-accept-package-args

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented May 13, 2026

vp rebuild previously only accepted -- pass-through args, so running
vp rebuild better-sqlite3 errored with "Unexpected argument". Combined
with pnpm v10+ only rebuilding packages whose build scripts are approved,
bare vp rebuild was a no-op for native modules like better-sqlite3 (71ms
vs 11.7s for pnpm rebuild better-sqlite3) and the user had no
discoverable way to name a package.

Add a packages: Vec positional to the Rebuild clap variant,
matching what the RFC (rfcs/pm-command-group.md §17, lines 660-680 and
mapping table at 1283-1304) already specifies. Forward the names to
pnpm/npm rebuild before the pass-through args. Yarn/Bun paths are
unchanged (warn-and-skip).

Snap test packages/cli/snap-tests-global/command-rebuild-pnpm11 captures
both the help output and the previously-broken positional form.


Note

Low Risk
Low risk: limited to rebuild CLI parsing/argument forwarding plus tests/docs; no security- or data-sensitive behavior changes.

Overview
vp rebuild now accepts positional package names (e.g. vp rebuild better-sqlite3 sharp) and forwards them to the underlying npm/pnpm rebuild invocation, fixing the previous “Unexpected argument” behavior.

This threads a new packages field through RebuildCommandOptions, updates the CLI/handler wiring, and extends unit + snapshot tests and docs to cover the new usage (Yarn/Bun remain warn-and-skip).

Reviewed by Cursor Bugbot for commit a92cba8. Configure here.

vp rebuild previously only accepted -- pass-through args, so running
vp rebuild better-sqlite3 errored with "Unexpected argument". Combined
with pnpm v10+ only rebuilding packages whose build scripts are approved,
bare vp rebuild was a no-op for native modules like better-sqlite3 (71ms
vs 11.7s for pnpm rebuild better-sqlite3) and the user had no
discoverable way to name a package.

Add a packages: Vec<String> positional to the Rebuild clap variant,
matching what the RFC (rfcs/pm-command-group.md §17, lines 660-680 and
mapping table at 1283-1304) already specifies. Forward the names to
pnpm/npm rebuild before the pass-through args. Yarn/Bun paths are
unchanged (warn-and-skip).

Snap test packages/cli/snap-tests-global/command-rebuild-pnpm11 captures
both the help output and the previously-broken positional form.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit a596c48
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a043781ae858800086de5ba

Copy link
Copy Markdown
Member Author

fengmk2 commented May 13, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 self-assigned this May 13, 2026
Move packages slice to append after pass_through_args in
resolve_rebuild_command, matching update.rs:194-197, remove.rs:147-150,
and add.rs:242-245. Resulting command becomes pnpm rebuild --recursive
better-sqlite3 instead of pnpm rebuild better-sqlite3 --recursive — same
semantics for pnpm/npm, but consistent with the rest of the codebase.

Also trim the packages doc comment in cli.rs; the pnpm v10+
approved-builds caveat already lives in docs/guide/install.md and
shouldn't bloat --help.
Copy link
Copy Markdown
Member Author

fengmk2 commented May 13, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a92cba8. Configure here.

Add a tracing::debug! span at the spawn site of both run_command and
run_command_with_fspy logging the resolved program path, args, and cwd.
Gated on the existing VITE_LOG env var, so it's free at runtime when
unset.

Useful for diagnosing how vite-plus pm subcommands forward arguments to
the underlying package manager — e.g. confirming that

  VITE_LOG=vite_command=debug vp rebuild better-sqlite3

actually spawns pnpm with ["rebuild", "better-sqlite3"].
@fengmk2 fengmk2 marked this pull request as ready for review May 13, 2026 08:57
@fengmk2 fengmk2 requested a review from cpojer May 13, 2026 08:57
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.

2 participants