Skip to content

Commit 8273201

Browse files
committed
feat: add vpr alias hint in vp -h help and add snap test
Show "(also available as standalone `vpr`)" next to the `run` command in the top-level help output. Add snap test for the `vpr` command verifying script execution, argument passthrough, and missing script error via PM fallback.
1 parent 5afaf9c commit 8273201

5 files changed

Lines changed: 37 additions & 2 deletions

File tree

crates/vite_global_cli/src/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ pub fn top_level_help_doc() -> HelpDoc {
449449
section_rows(
450450
"Execute",
451451
vec![
452-
row("run", "Run tasks"),
452+
row("run", "Run tasks (also available as standalone `vpr`)"),
453453
row("exec", "Execute a command from local node_modules/.bin"),
454454
row("dlx", "Execute a package binary without installing it as a dependency"),
455455
row("cache", "Manage the task cache"),

packages/cli/snap-tests-global/cli-helper-message/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Develop:
1919
test Run tests
2020

2121
Execute:
22-
run Run tasks
22+
run Run tasks (also available as standalone `vpr`)
2323
exec Execute a command from local node_modules/.bin
2424
dlx Execute a package binary without installing it as a dependency
2525
cache Manage the task cache
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "command-vpr",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"hello": "echo hello from script",
6+
"greet": "echo greet"
7+
},
8+
"packageManager": "pnpm@10.19.0"
9+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
> vpr hello # should fall back to pnpm run when no vite-plus dependency
2+
3+
> command-vpr@<semver> hello <cwd>
4+
> echo hello from script
5+
6+
hello from script
7+
8+
> vpr greet --arg1 value1 # should pass through args to pnpm run
9+
10+
> command-vpr@<semver> greet <cwd>
11+
> echo greet --arg1 value1
12+
13+
greet --arg1 value1
14+
15+
[1]> vpr nonexistent # should show pnpm missing script error
16+
 ERR_PNPM_NO_SCRIPT  Missing script: nonexistent
17+
18+
Command "nonexistent" not found.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
"vpr hello # should fall back to pnpm run when no vite-plus dependency",
5+
"vpr greet --arg1 value1 # should pass through args to pnpm run",
6+
"vpr nonexistent # should show pnpm missing script error"
7+
]
8+
}

0 commit comments

Comments
 (0)