Skip to content

Commit 663cabd

Browse files
committed
feat(installer): show resolved install locations
1 parent a1e9979 commit 663cabd

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
@@ -285,7 +285,12 @@ jobs:
285285
export VP_VPDIRS_AWARE=1
286286
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
287287
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
288-
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh
288+
OUTPUT=$(mktemp)
289+
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh | tee "$OUTPUT"
290+
291+
grep -F "Install locations:" "$OUTPUT"
292+
grep -F "Data directory: ~/.local/share/vite-plus" "$OUTPUT"
293+
grep -F "Bin directory: ~/.local/share/vite-plus/bin" "$OUTPUT"
289294
290295
test ! -d "$FRESH/.vite-plus"
291296
test -e "$FRESH/.local/share/vite-plus/current"
@@ -457,6 +462,18 @@ jobs:
457462
Write-Error "Expected the pre-split fallback notice in installer output"
458463
exit 1
459464
}
465+
if (-not (Select-String -Path install-output.txt -Pattern "Install locations:" -SimpleMatch -Quiet)) {
466+
Write-Error "Expected install locations in installer output"
467+
exit 1
468+
}
469+
if (-not (Select-String -Path install-output.txt -Pattern "Data directory: ~\.vite-plus" -SimpleMatch -Quiet)) {
470+
Write-Error "Expected the single-root data directory in installer output"
471+
exit 1
472+
}
473+
if (-not (Select-String -Path install-output.txt -Pattern "Bin directory: ~\.vite-plus\bin" -SimpleMatch -Quiet)) {
474+
Write-Error "Expected the single-root bin directory in installer output"
475+
exit 1
476+
}
460477
461478
- name: Verify monolithic layout
462479
shell: pwsh
@@ -510,8 +527,10 @@ jobs:
510527
echo "$output"
511528
# Verify installation succeeds (not a fatal error)
512529
echo "$output" | grep -q "successfully installed"
513-
# Verify fallback message shows binary location
514-
echo "$output" | grep -q "vp was installed to:"
530+
# Verify the success message shows the single-root locations
531+
echo "$output" | grep -q "Install locations:"
532+
echo "$output" | grep -q "Data directory: ~/.vite-plus"
533+
echo "$output" | grep -q "Bin directory: ~/.vite-plus/bin"
515534
# Verify fallback message shows manual instructions
516535
echo "$output" | grep -q "Or run vp directly:"
517536
# Verify the permission warning was shown
@@ -1422,7 +1441,17 @@ jobs:
14221441
New-Item -ItemType Directory -Force -Path $root | Out-Null
14231442
New-Item -ItemType File -Force -Path $env:VP_LOCAL_TGZ | Out-Null
14241443
1425-
& ./packages/cli/install.ps1
1444+
$output = (& ./packages/cli/install.ps1 *>&1) | Out-String
1445+
Write-Host $output
1446+
if (-not $output.Contains("Install locations:")) {
1447+
throw "install.ps1 did not print install locations"
1448+
}
1449+
if (-not $output.Contains("Data directory: $($env:VP_DATA_DIR)")) {
1450+
throw "install.ps1 did not print the split data directory"
1451+
}
1452+
if (-not $output.Contains("Bin directory: $($env:VP_BIN_DIR)")) {
1453+
throw "install.ps1 did not print the split bin directory"
1454+
}
14261455
14271456
function Get-DirMap([string]$VpBinary) {
14281457
$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
@@ -1411,9 +1411,10 @@ WRAPPER_EOF
14111411
# Configure shell PATH after the install is otherwise complete.
14121412
configure_shell_path
14131413

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

14181419
# Print success message
14191420
echo ""
@@ -1436,6 +1437,11 @@ WRAPPER_EOF
14361437
echo ""
14371438
echo -e " Run ${BRIGHT_BLUE}vp help${NC} to see available commands."
14381439

1440+
echo ""
1441+
echo -e " ${BOLD}Install locations:${NC}"
1442+
echo " Data directory: $display_data_dir"
1443+
echo " Bin directory: $display_bin_dir"
1444+
14391445
echo ""
14401446
echo " Shell configuration:"
14411447
local summary_line
@@ -1454,8 +1460,6 @@ WRAPPER_EOF
14541460
echo ""
14551461
echo -e " ${YELLOW}note${NC}: Some shells still need manual setup."
14561462
echo ""
1457-
echo -e " vp was installed to: ${BOLD}${display_location}${NC}"
1458-
echo ""
14591463
echo " Manual setup instructions:"
14601464
echo " - Bash/Zsh: add the following to your shell config (~/.bashrc, ~/.zshrc, etc.):"
14611465
printf ' . "%s/env"\n' "$CONFIG_DIR_REF_POSIX"
@@ -1466,7 +1470,7 @@ WRAPPER_EOF
14661470
echo ""
14671471
echo " Or run vp directly:"
14681472
echo ""
1469-
echo -e " ${display_location}/vp"
1473+
echo -e " ${display_bin_dir}/vp"
14701474
fi
14711475

14721476
echo ""

0 commit comments

Comments
 (0)