feat(create-vite): support Vite+ (vp) package manager#22788
Draft
fengmk2 wants to merge 1 commit into
Draft
Conversation
Detect Vite+ from the `VP_USER_AGENT` env var that `vp` sets (the underlying package manager overwrites `npm_config_user_agent`), and emit vp commands: `vp install`, `vp dev`, and `vp dlx` for template custom commands.
Contributor
Author
|
@codex review |
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.
Description
When
create-viteis run viavp dlx create-vite(Vite+), it currently falls back tonpmcommands because the underlying package manager (pnpm/npm/yarn/bun) overwritesnpm_config_user_agent, hiding that vp launched it.This teaches
create-viteto recognize vp:VP_USER_AGENTenv var that vp sets (falls back tonpm_config_user_agentas before).getRunCommandemitsvp dev;getInstallCommandalready yieldsvp install.getFullCustomCommandmapsnpm createtovp dlx create-andnpm exectovp dlx(same shape as the existing bun/pnpm/deno branches).Result: a
vp dlx create-viterun finishes withvp install/vp dev, and template custom commands usevp dlx.Why
vp dlx create-and notvp createnpm create Xis defined asnpm exec create-X, andvp dlx create-Xis the exact structural equivalent (dlx=exec), forwarding all positionals and flags straight to the create-* binary.vp createwas considered but is unsuitable here: it consumes the target-dir positional itself (uses its own--directoryflag), so theTARGET_DIRconvention is dropped, and thenpm create -- vike@latest --vue TARGET_DIRtemplates need their template flags after a--separator that a prefix-only replacement cannot produce.vp createis also a richer, opinionated flow (adds agent/editor/git/hooks setup) rather than a transparent passthrough.Note
The companion change that makes vp set
VP_USER_AGENTships in the vite-plus repo (voidzero-dev/vite-plus#1958). Until that lands, behavior is unchanged for all existing package managers.Test
Added a
create-viteCLI test asserting thatVP_USER_AGENTtakes precedence overnpm_config_user_agentand producesvp install/vp dev.