Skip to content

Commit 9726a19

Browse files
committed
feat(installer): show resolved install locations
1 parent 5f01a7e commit 9726a19

3 files changed

Lines changed: 51 additions & 14 deletions

File tree

.github/workflows/test-standalone-install.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ jobs:
264264
export VP_VPDIRS_AWARE=1
265265
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
266266
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
267-
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh
267+
OUTPUT=$(mktemp)
268+
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh | tee "$OUTPUT"
269+
270+
grep -F "Install locations:" "$OUTPUT"
271+
grep -F "Data directory: ~/.local/share/vite-plus" "$OUTPUT"
272+
grep -F "Bin directory: ~/.local/share/vite-plus/bin" "$OUTPUT"
268273
269274
test ! -d "$FRESH/.vite-plus"
270275
test -e "$FRESH/.local/share/vite-plus/current"
@@ -436,6 +441,18 @@ jobs:
436441
Write-Error "Expected the pre-split fallback notice in installer output"
437442
exit 1
438443
}
444+
if (-not (Select-String -Path install-output.txt -Pattern "Install locations:" -SimpleMatch -Quiet)) {
445+
Write-Error "Expected install locations in installer output"
446+
exit 1
447+
}
448+
if (-not (Select-String -Path install-output.txt -Pattern "Data directory: ~\.vite-plus" -SimpleMatch -Quiet)) {
449+
Write-Error "Expected the single-root data directory in installer output"
450+
exit 1
451+
}
452+
if (-not (Select-String -Path install-output.txt -Pattern "Bin directory: ~\.vite-plus\bin" -SimpleMatch -Quiet)) {
453+
Write-Error "Expected the single-root bin directory in installer output"
454+
exit 1
455+
}
439456
440457
- name: Verify monolithic layout
441458
shell: pwsh
@@ -489,8 +506,10 @@ jobs:
489506
echo "$output"
490507
# Verify installation succeeds (not a fatal error)
491508
echo "$output" | grep -q "successfully installed"
492-
# Verify fallback message shows binary location
493-
echo "$output" | grep -q "vp was installed to:"
509+
# Verify the success message shows the single-root locations
510+
echo "$output" | grep -q "Install locations:"
511+
echo "$output" | grep -q "Data directory: ~/.vite-plus"
512+
echo "$output" | grep -q "Bin directory: ~/.vite-plus/bin"
494513
# Verify fallback message shows manual instructions
495514
echo "$output" | grep -q "Or run vp directly:"
496515
# Verify the permission warning was shown
@@ -1401,7 +1420,17 @@ jobs:
14011420
New-Item -ItemType Directory -Force -Path $root | Out-Null
14021421
New-Item -ItemType File -Force -Path $env:VP_LOCAL_TGZ | Out-Null
14031422
1404-
& ./packages/cli/install.ps1
1423+
$output = (& ./packages/cli/install.ps1 *>&1) | Out-String
1424+
Write-Host $output
1425+
if (-not $output.Contains("Install locations:")) {
1426+
throw "install.ps1 did not print install locations"
1427+
}
1428+
if (-not $output.Contains("Data directory: $($env:VP_DATA_DIR)")) {
1429+
throw "install.ps1 did not print the split data directory"
1430+
}
1431+
if (-not $output.Contains("Bin directory: $($env:VP_BIN_DIR)")) {
1432+
throw "install.ps1 did not print the split bin directory"
1433+
}
14051434
14061435
function Get-DirMap([string]$VpBinary) {
14071436
$env:VP_DUMP_DIRS = "1"

packages/cli/install.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,9 +1177,10 @@ exec "`$VP_HOME/current/bin/vp.exe" "`$@"
11771177
$pathResult = Configure-UserPath
11781178
$nushellResult = Configure-Nushell
11791179

1180-
# Use ~ when the shim directory is under USERPROFILE. Otherwise, show the
1180+
# Use ~ when an install location is under USERPROFILE. Otherwise, show the
11811181
# full path.
1182-
$displayDir = $ShimDir -replace [regex]::Escape($env:USERPROFILE), '~'
1182+
$displayDataDir = $InstallDir -replace [regex]::Escape($env:USERPROFILE), '~'
1183+
$displayBinDir = $ShimDir -replace [regex]::Escape($env:USERPROFILE), '~'
11831184
$displayConfigDir = $ConfigDir -replace [regex]::Escape($env:USERPROFILE), '~'
11841185

11851186
# ANSI color codes for consistent output
@@ -1215,6 +1216,11 @@ exec "`$VP_HOME/current/bin/vp.exe" "`$@"
12151216
Write-Host ""
12161217
Write-Host " Run ${BRIGHT_BLUE}vp help${NC} to see available commands."
12171218

1219+
Write-Host ""
1220+
Write-Host " ${BOLD}Install locations:${NC}"
1221+
Write-Host " Data directory: $displayDataDir"
1222+
Write-Host " Bin directory: $displayBinDir"
1223+
12181224
Write-Host ""
12191225
Write-Host " Shell configuration:"
12201226
switch ($pathResult) {
@@ -1238,8 +1244,6 @@ exec "`$VP_HOME/current/bin/vp.exe" "`$@"
12381244
Write-Host ""
12391245
Write-Host " ${YELLOW}note${NC}: Some shells still need manual setup."
12401246
Write-Host ""
1241-
Write-Host " vp was installed to: ${BOLD}${displayDir}${NC}"
1242-
Write-Host ""
12431247
if ($pathResult -eq "failed") {
12441248
Write-Host " To use vp in Powershell/cmd, manually add it to your PATH:"
12451249
Write-Host ""

packages/cli/install.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,9 +1408,10 @@ WRAPPER_EOF
14081408
# Configure shell PATH after the install is otherwise complete.
14091409
configure_shell_path
14101410

1411-
# Use ~ when the shim directory is under HOME. Otherwise, show the full path.
1412-
local display_location
1413-
display_location="$(abbreviate_path "$SHIM_DIR")"
1411+
# Use ~ when an install location is under HOME. Otherwise, show the full path.
1412+
local display_data_dir display_bin_dir
1413+
display_data_dir="$(abbreviate_path "$INSTALL_DIR")"
1414+
display_bin_dir="$(abbreviate_path "$SHIM_DIR")"
14141415

14151416
# Print success message
14161417
echo ""
@@ -1433,6 +1434,11 @@ WRAPPER_EOF
14331434
echo ""
14341435
echo -e " Run ${BRIGHT_BLUE}vp help${NC} to see available commands."
14351436

1437+
echo ""
1438+
echo -e " ${BOLD}Install locations:${NC}"
1439+
echo " Data directory: $display_data_dir"
1440+
echo " Bin directory: $display_bin_dir"
1441+
14361442
echo ""
14371443
echo " Shell configuration:"
14381444
local summary_line
@@ -1451,8 +1457,6 @@ WRAPPER_EOF
14511457
echo ""
14521458
echo -e " ${YELLOW}note${NC}: Some shells still need manual setup."
14531459
echo ""
1454-
echo -e " vp was installed to: ${BOLD}${display_location}${NC}"
1455-
echo ""
14561460
echo " Manual setup instructions:"
14571461
echo " - Bash/Zsh: add the following to your shell config (~/.bashrc, ~/.zshrc, etc.):"
14581462
printf ' . "%s/env"\n' "$CONFIG_DIR_REF_POSIX"
@@ -1463,7 +1467,7 @@ WRAPPER_EOF
14631467
echo ""
14641468
echo " Or run vp directly:"
14651469
echo ""
1466-
echo -e " ${display_location}/vp"
1470+
echo -e " ${display_bin_dir}/vp"
14671471
fi
14681472

14691473
echo ""

0 commit comments

Comments
 (0)