You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add vp exec command for local node_modules/.bin execution (#620)
Add `vp exec` as the equivalent of `pnpm exec` — prepends
`./node_modules/.bin` to PATH and executes a command. Commands resolve
through the modified PATH (local bins first, then system PATH), matching
pnpm exec's real behavior. No remote fallback unlike `vpx`.
Global CLI: delegates to local CLI when vite-plus is a dependency,
otherwise handles exec directly (prepend PATH + spawn).
Local CLI: prepends PM bin dir and node_modules/.bin to PATH, sets
VITE_PLUS_PACKAGE_NAME env var, supports --shell-mode/-c flag.
closes [VP-194](https://linear.app/voidzero/issue/VP-194/equivalent-of-pnpm-filter-pkgname-exec-some-cmd)
When writing Rust code that needs to spawn subprocesses (resolve binaries, build commands, execute programs), always use the `vite_command` crate. Never use `which`, `tokio::process::Command::new`, or `std::process::Command::new` directly.
10
+
11
+
## Available APIs
12
+
13
+
### `vite_command::resolve_bin(name, path_env, cwd)` — Resolve a binary name to an absolute path
14
+
15
+
Handles PATHEXT (`.cmd`/`.bat`) on Windows. Pass `None` for `path_env` to search the current process PATH.
### `vite_command::build_command(bin_path, cwd)` — Build a command for a pre-resolved binary
27
+
28
+
Returns `tokio::process::Command` with cwd, inherited stdio, and `fix_stdio_streams` on Unix already configured. Add args, envs, or override stdio as needed.
Do NOT add `which` as a direct dependency — binary resolution goes through `vite_command::resolve_bin`.
68
+
69
+
## Exception
70
+
71
+
`crates/vite_global_cli/src/shim/exec.rs` uses synchronous `std::process::Command` with Unix `exec()` for process replacement. This is the only place that bypasses `vite_command`.
Copy file name to clipboardExpand all lines: packages/cli/AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ This project is using Vite+, a modern toolchain built on top of Vite, Rolldown,
18
18
- lib - Build library
19
19
- migrate - Migrate an existing project to Vite+
20
20
- new - Create a new monorepo package (in-project) or a new project (global)
21
+
- exec - Execute a command in workspace packages (supports `--filter`, `-r`, `--parallel`)
21
22
- run - Run tasks from `package.json` scripts
22
23
23
24
These commands map to their corresponding tools. For example, `vp dev --port 3000` runs Vite's dev server and works the same as Vite. `vp test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vp --version`. This is useful when researching documentation, features, and bugs.
0 commit comments