Skip to content

Commit 482a880

Browse files
authored
Merge branch 'main' into main
2 parents f8b9196 + 543a054 commit 482a880

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

packages/cli/install.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,23 @@ function Main {
316316
} | ConvertTo-Json -Depth 10
317317
Set-Content -Path (Join-Path $VersionDir "package.json") -Value $wrapperJson
318318

319+
# Isolate from user's global package manager config that may block
320+
# installing recently-published packages (e.g. pnpm's minimumReleaseAge,
321+
# npm's min-release-age) by creating a local .npmrc in the version directory.
322+
Set-Content -Path (Join-Path $VersionDir ".npmrc") -Value "minimum-release-age=0`nmin-release-age=0"
323+
319324
# Install production dependencies (skip if VITE_PLUS_SKIP_DEPS_INSTALL is set,
320325
# e.g. during local dev where install-global-cli.ts handles deps separately)
321326
if (-not $env:VITE_PLUS_SKIP_DEPS_INSTALL) {
327+
$installLog = Join-Path $VersionDir "install.log"
322328
Push-Location $VersionDir
323329
try {
324330
$env:CI = "true"
325-
& "$BinDir\vp.exe" install --silent
331+
& "$BinDir\vp.exe" install --silent *> $installLog
332+
if ($LASTEXITCODE -ne 0) {
333+
Write-Host "error: Failed to install dependencies. See log for details: $installLog" -ForegroundColor Red
334+
exit 1
335+
}
326336
} finally {
327337
Pop-Location
328338
}

packages/cli/install.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,22 @@ main() {
592592
}
593593
WRAPPER_EOF
594594

595+
# Isolate from user's global package manager config that may block
596+
# installing recently-published packages (e.g. pnpm's minimumReleaseAge,
597+
# npm's min-release-age) by creating a local .npmrc in the version directory.
598+
cat > "$VERSION_DIR/.npmrc" <<NPMRC_EOF
599+
minimum-release-age=0
600+
min-release-age=0
601+
NPMRC_EOF
602+
595603
# Install production dependencies (skip if VITE_PLUS_SKIP_DEPS_INSTALL is set,
596604
# e.g. during local dev where install-global-cli.ts handles deps separately)
597605
if [ -z "${VITE_PLUS_SKIP_DEPS_INSTALL:-}" ]; then
598-
(cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent)
606+
local install_log="$VERSION_DIR/install.log"
607+
if ! (cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent > "$install_log" 2>&1); then
608+
error "Failed to install dependencies. See log for details: $install_log"
609+
exit 1
610+
fi
599611
fi
600612

601613
# Create/update current symlink (use relative path for portability)

0 commit comments

Comments
 (0)