Skip to content

Commit e97f293

Browse files
authored
Merge branch 'main' into patch-1
2 parents 83d51ff + 543a054 commit e97f293

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
@@ -586,10 +586,22 @@ main() {
586586
}
587587
WRAPPER_EOF
588588

589+
# Isolate from user's global package manager config that may block
590+
# installing recently-published packages (e.g. pnpm's minimumReleaseAge,
591+
# npm's min-release-age) by creating a local .npmrc in the version directory.
592+
cat > "$VERSION_DIR/.npmrc" <<NPMRC_EOF
593+
minimum-release-age=0
594+
min-release-age=0
595+
NPMRC_EOF
596+
589597
# Install production dependencies (skip if VITE_PLUS_SKIP_DEPS_INSTALL is set,
590598
# e.g. during local dev where install-global-cli.ts handles deps separately)
591599
if [ -z "${VITE_PLUS_SKIP_DEPS_INSTALL:-}" ]; then
592-
(cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent)
600+
local install_log="$VERSION_DIR/install.log"
601+
if ! (cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent > "$install_log" 2>&1); then
602+
error "Failed to install dependencies. See log for details: $install_log"
603+
exit 1
604+
fi
593605
fi
594606

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

0 commit comments

Comments
 (0)