Skip to content

Commit 16aec32

Browse files
committed
feat(env): show all binaries in vp env which output for global packages
Add a "Binaries" line to `vp env which` output, helping users understand what other commands are available from the same installed package. Also pin cowsay version in snap test to prevent future breaking changes.
1 parent 33eb4d5 commit 16aec32

5 files changed

Lines changed: 8 additions & 10 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ async fn execute_package_binary(
100100

101101
// Print metadata
102102
println!(" Package: {}@{}", metadata.name, metadata.version);
103+
println!(" Binaries: {}", metadata.bins.join(", "));
103104
println!(" Node.js: {}", node_path.as_path().display());
104105
println!(" Installed: {}", installed_str);
105106

packages/global/snap-tests/command-env-which/snap.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ v20.18.0
1010
> vp env which npx # Core tool - shows resolved npx binary path
1111
<homedir>/.vite-plus-dev/js_runtime/node/<semver>/bin/npx
1212

13-
> vp env run npm install -g cowsay # Install a global package via vp
14-
vp: Installing global package: cowsay
15-
Installing cowsay globally...
13+
> vp env run npm install -g cowsay@1.6.0 # Install a global package via vp
14+
vp: Installing global package: cowsay@<semver>
15+
Installing cowsay@<semver> globally...
1616
Running npm install...
1717

1818
added 41 packages in <variable>ms
@@ -25,6 +25,7 @@ added 41 packages in <variable>ms
2525
> vp env which cowsay # Global package - shows binary path with metadata
2626
<homedir>/.vite-plus-dev/packages/cowsay/lib/node_modules/cowsay/./cli.js
2727
Package: cowsay@<semver>
28+
Binaries: cowsay, cowthink
2829
Node.js: <homedir>/.vite-plus-dev/js_runtime/node/<semver>/bin/node
2930
Installed: <date>
3031

packages/global/snap-tests/command-env-which/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"vp env which node # Core tool - shows resolved Node.js binary path",
77
"vp env which npm # Core tool - shows resolved npm binary path",
88
"vp env which npx # Core tool - shows resolved npx binary path",
9-
"vp env run npm install -g cowsay # Install a global package via vp",
9+
"vp env run npm install -g cowsay@1.6.0 # Install a global package via vp",
1010
"vp env which cowsay # Global package - shows binary path with metadata",
1111
"vp env run npm uninstall -g cowsay # Cleanup",
1212
"vp env which unknown-tool # Unknown tool - error message"

packages/tools/src/__tests__/__snapshots__/utils.spec.ts.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ exports[`replaceUnstableOutput() > replace ignore tarball download average speed
5454
5555
exports[`replaceUnstableOutput() > replace pnpm registry request error warning log 1`] = `"Progress: resolved"`;
5656
57-
exports[`replaceUnstableOutput() > replace semver version at start of line 1`] = `
58-
"v<semver>
59-
v<semver>
60-
<semver>"
61-
`;
62-
6357
exports[`replaceUnstableOutput() > replace tsdown output 1`] = `
6458
"ℹ tsdown v<semver> powered by rolldown v<semver>
6559
ℹ entry: src/index.ts

rfcs/env-command.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,12 +1121,14 @@ $ vp env which npm
11211121
$ vp env which tsc
11221122
/Users/user/.vite-plus/packages/typescript/lib/node_modules/typescript/bin/tsc
11231123
Package: typescript@5.7.0
1124+
Binaries: tsc, tsserver
11241125
Node.js: /Users/user/.vite-plus/js_runtime/node/20.18.0/bin/node
11251126
Installed: 2024-01-15 10:30:00
11261127
11271128
$ vp env which eslint
11281129
/Users/user/.vite-plus/packages/eslint/lib/node_modules/eslint/bin/eslint.js
11291130
Package: eslint@9.0.0
1131+
Binaries: eslint
11301132
Node.js: /Users/user/.vite-plus/js_runtime/node/22.13.0/bin/node
11311133
Installed: 2024-02-20 14:45:30
11321134
```

0 commit comments

Comments
 (0)