Skip to content

Commit 7106afb

Browse files
committed
Install pnpm globally if missing and invoke it directly in install scripts
- instead of running pnpm through npx, should install pnpm globally ├── install.ps1 ├── install.sh └── package.json
1 parent 5f33314 commit 7106afb

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎install.ps1‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@ function Invoke-Step {
457457

458458
Write-Host ""
459459

460+
if (!(Get-Command pnpm -ErrorAction SilentlyContinue)) {
461+
npm install -g pnpm *>$null
462+
}
463+
460464
$originalLocation = Get-Location
461465

462466
$cwcDir = Join-Path $env:USERPROFILE ".cwc"
@@ -532,7 +536,7 @@ foreach ($i in $indices) {
532536
Set-Location $repoDir
533537

534538
$depsOk = Invoke-Step "$msg_step_deps..." {
535-
npx.cmd --yes pnpm install *>$null
539+
pnpm install *>$null
536540
}
537541

538542
if (-not $depsOk) {
@@ -542,7 +546,7 @@ foreach ($i in $indices) {
542546

543547
$prevPreference = $ErrorActionPreference
544548
$ErrorActionPreference = "Continue"
545-
try { npx.cmd --yes pnpm store prune *>$null } catch {}
549+
try { pnpm store prune *>$null } catch {}
546550
$ErrorActionPreference = $prevPreference
547551

548552
$null = Invoke-Step "$msg_step_cloning..." {
@@ -552,7 +556,7 @@ foreach ($i in $indices) {
552556
Set-Location $repoDir
553557

554558
$null = Invoke-Step "$msg_step_deps..." {
555-
npx.cmd --yes pnpm install *>$null
559+
pnpm install *>$null
556560
} $msg_step_deps
557561
}
558562

@@ -561,7 +565,7 @@ foreach ($i in $indices) {
561565
Remove-Item *.vsix -Force -ErrorAction SilentlyContinue
562566

563567
$null = Invoke-Step "$msg_step_build..." {
564-
npx.cmd --yes pnpm run build *>$null
568+
pnpm run build *>$null
565569
} $msg_step_build
566570

567571
$vsixFile = Get-ChildItem *.vsix -ErrorAction SilentlyContinue | Select-Object -First 1

‎install.sh‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ run_step() {
492492

493493
echo ""
494494

495+
if ! command -v pnpm >/dev/null 2>&1; then
496+
npm install -g pnpm >/dev/null 2>&1 || true
497+
fi
498+
495499
CWC_DIR="$HOME/.cwc"
496500

497501
mkdir -p -m 700 "$CWC_DIR"
@@ -555,21 +559,21 @@ for i in "${indices[@]}"; do
555559

556560
cd "$REPO_DIR"
557561

558-
if ! run_step "$msg_step_deps" npx --yes pnpm install; then
562+
if ! run_step "$msg_step_deps" pnpm install; then
559563
echo -e " \033[33m$msg_deps_retry\033[0m"
560564
cd "$CWC_DIR"
561565
rm -rf "$CWC_DIR"/repository*
562-
npx --yes pnpm store prune > /dev/null 2>&1 || true
566+
pnpm store prune > /dev/null 2>&1 || true
563567
run_step "$msg_step_cloning" clone_repo
564568
cd "$REPO_DIR"
565-
run_step "$msg_step_deps" npx --yes pnpm install
569+
run_step "$msg_step_deps" pnpm install
566570
fi
567571

568572
cd apps/editor
569573

570574
rm -f ./*.vsix
571575

572-
run_step "$msg_step_build" npx --yes pnpm run build
576+
run_step "$msg_step_build" pnpm run build
573577

574578
vsix_files=(*.vsix)
575579
VSIX_FILE="${vsix_files[0]}"

0 commit comments

Comments
 (0)