Skip to content

Commit 1642c76

Browse files
authored
feat(cli): implement vpx command for local-first package execution (#578)
Add `vpx` as a standalone binary (symlink to `vp`) that checks local `node_modules/.bin` first, then falls back to `vp dlx` for remote download. This is analogous to how `npx` works. - Local binary lookup walks up from cwd checking node_modules/.bin - Version specs (e.g., `eslint@9`) skip local lookup and go remote - Supports --package/-p, --shell-mode/-c, --silent/-s flags - Shim created by `vp env setup` alongside node/npm/npx - On Windows, uses `vp env exec vpx` pattern like other shims
1 parent e3502b6 commit 1642c76

9 files changed

Lines changed: 1305 additions & 9 deletions

File tree

crates/vite_global_cli/src/commands/env/setup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use std::process::ExitStatus;
1818
use super::config::{get_bin_dir, get_vite_plus_home};
1919
use crate::error::Error;
2020

21-
/// Tools to create shims for (node, npm, npx)
22-
const SHIM_TOOLS: &[&str] = &["node", "npm", "npx"];
21+
/// Tools to create shims for (node, npm, npx, vpx)
22+
const SHIM_TOOLS: &[&str] = &["node", "npm", "npx", "vpx"];
2323

2424
/// Execute the setup command.
2525
pub async fn execute(refresh: bool, env_only: bool) -> Result<ExitStatus, Error> {
@@ -222,7 +222,7 @@ async fn create_unix_shim(
222222

223223
/// Create Windows shims using .cmd wrappers that call `vp env exec <tool>`.
224224
///
225-
/// All tools (node, npm, npx) get .cmd wrappers that invoke `vp env exec`.
225+
/// All tools (node, npm, npx, vpx) get .cmd wrappers that invoke `vp env exec`.
226226
/// Also creates shell scripts (without extension) for Git Bash compatibility.
227227
/// This is consistent with Volta's Windows approach.
228228
#[cfg(windows)]

crates/vite_global_cli/src/commands/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ pub mod version;
139139
// Category D: Environment Management
140140
pub mod env;
141141

142+
// Standalone binary command
143+
pub mod vpx;
144+
142145
// Self-Management
143146
pub mod upgrade;
144147

0 commit comments

Comments
 (0)