Skip to content

Commit 3c2c73c

Browse files
authored
fix(install): suppress banner/tips and improve post-install messages (#768)
## Summary - Suppress VITE+ header banner when `--silent` is passed to `vp install` - Suppress tips (e.g. "Available short aliases") when `CI` env var is set, since tips are for interactive users - Replace `vp dev` with `vp migrate` in post-install "Get started" section (dev is a project command, not available after fresh global install) - Change "Run vp help for more information" to "Run vp help to see available commands" ## Test plan - [x] `cargo test -p vite_global_cli` — 294 passed - [x] Verify snap test diffs are correct (banner lines removed from `--silent` output) - [x] CI: install.ps1 on PowerShell 5.1 no longer leaks tips/banner - [x] CI: [install.sh](http://install.sh) no longer leaks tips/banner 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 9eaeeb9 commit 3c2c73c

6 files changed

Lines changed: 7 additions & 20 deletions

File tree

crates/vite_global_cli/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ pub async fn run_command_with_options(
15381538
packages,
15391539
pass_through_args,
15401540
} => {
1541-
print_runtime_header(render_options.show_header);
1541+
print_runtime_header(render_options.show_header && !silent);
15421542
// If packages are provided, redirect to Add command
15431543
if let Some(pkgs) = packages
15441544
&& !pkgs.is_empty()

crates/vite_global_cli/src/tips/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn all() -> &'static [&'static dyn Tip] {
7979
/// - The `VITE_PLUS_CLI_TEST` env var is set (test mode)
8080
/// - No tips match the given context
8181
pub fn get_tip(context: &TipContext) -> Option<&'static str> {
82-
if std::env::var_os("VITE_PLUS_CLI_TEST").is_some() {
82+
if std::env::var_os("VITE_PLUS_CLI_TEST").is_some() || std::env::var_os("CI").is_some() {
8383
return None;
8484
}
8585

packages/cli/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ exec "`$VITE_PLUS_HOME/current/bin/vp.exe" "`$@"
390390
Write-Host " ${BRIGHT_BLUE}vp create${NC} Create a new project"
391391
Write-Host " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
392392
Write-Host " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
393-
Write-Host " ${BRIGHT_BLUE}vp dev${NC} Start dev server"
393+
Write-Host " ${BRIGHT_BLUE}vp migrate${NC} Migrate to Vite+"
394394

395395
# Show Node.js manager status
396396
if ($nodeManagerResult -eq "true" -or $nodeManagerResult -eq "already") {
@@ -400,7 +400,7 @@ exec "`$VITE_PLUS_HOME/current/bin/vp.exe" "`$@"
400400
}
401401

402402
Write-Host ""
403-
Write-Host " Run ${BRIGHT_BLUE}vp help${NC} for more information."
403+
Write-Host " Run ${BRIGHT_BLUE}vp help${NC} to see available commands."
404404

405405
# Show note if PATH was updated
406406
if ($pathResult -eq "true") {

packages/cli/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ WRAPPER_EOF
613613
echo -e " ${BRIGHT_BLUE}vp create${NC} Create a new project"
614614
echo -e " ${BRIGHT_BLUE}vp env${NC} Manage Node.js versions"
615615
echo -e " ${BRIGHT_BLUE}vp install${NC} Install dependencies"
616-
echo -e " ${BRIGHT_BLUE}vp dev${NC} Start dev server"
616+
echo -e " ${BRIGHT_BLUE}vp migrate${NC} Migrate to Vite+"
617617

618618
if [ "$NODE_MANAGER_ENABLED" = "true" ] || [ "$NODE_MANAGER_ENABLED" = "already" ]; then
619619
echo ""
@@ -622,7 +622,7 @@ WRAPPER_EOF
622622
fi
623623

624624
echo ""
625-
echo -e " Run ${BRIGHT_BLUE}vp help${NC} for more information."
625+
echo -e " Run ${BRIGHT_BLUE}vp help${NC} to see available commands."
626626

627627
# Show restart note if PATH was added to shell config
628628
if [ "$PATH_CONFIGURED" = "true" ] && [ -n "$SHELL_CONFIG_UPDATED" ]; then

packages/cli/snap-tests-global/command-install-auto-create-package-json/snap.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
no package.json
33

44
> vp install --silent && cat package.json # should auto-create package.json and install
5-
VITE+ - The Unified Toolchain for the Web
6-
75
{
86
"type": "module",
97
"packageManager": "pnpm@<semver>"
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
> vp install --no-frozen-lockfile --silent # install dependencies work
2-
VITE+ - The Unified Toolchain for the Web
3-
4-
52
> mkdir -p packages/sub-project && echo '{"name": "sub-project", "dependencies": { "testnpm2": "1.0.0" }}' > packages/sub-project/package.json # create sub project and package.json
63
> vp install --no-frozen-lockfile --silent # install again should work and without cache
7-
VITE+ - The Unified Toolchain for the Web
8-
9-
104
> ls packages/sub-project/node_modules/testnpm2/package.json # check testnpm2 is installed
115
packages/sub-project/node_modules/testnpm2/package.json
126

137
> mkdir -p others/other && echo '{"name": "other", "dependencies": { "testnpm2": "1.0.0" }}' > others/other/package.json # create non workspace project
148
> vp install --no-frozen-lockfile --silent # should install cache hit
15-
VITE+ - The Unified Toolchain for the Web
16-
17-
189
> test -d others/other/node_modules/testnpm2 && echo 'Error: directory exists.' >&2 && exit 1 || true # check testnpm2 is not installed
1910
> rm -rf packages/sub-project # remove sub project
20-
> vp install --no-frozen-lockfile --silent | sed -E 's|packages.*|packages*|' # should install again without cache
21-
VITE+ - The Unified Toolchain for the Web
22-
11+
> vp install --no-frozen-lockfile --silent | sed -E 's|packages.*|packages*|' # should install again without cache

0 commit comments

Comments
 (0)