INSTALL.ps1 (1391B)
1 $ErrorActionPreference = "Stop" 2 3 Set-Location $PSScriptRoot 4 5 Write-Host "[Bzl] Installer (PowerShell)" -ForegroundColor Cyan 6 Write-Host "[Bzl] This will run npm install (if needed) and a quick init wizard." 7 8 function Require-Cmd($name) { 9 $cmd = Get-Command $name -ErrorAction SilentlyContinue 10 if (-not $cmd) { throw "Missing required command: $name" } 11 } 12 13 Require-Cmd node 14 Require-Cmd npm.cmd 15 16 Write-Host "[Bzl] Node:" (node -v) 17 Write-Host "[Bzl] npm:" (npm.cmd -v) 18 19 $nodeMajor = [int]((node -p "process.versions.node.split('.')[0]" 2>$null) -join "") 20 if ($nodeMajor -lt 18) { throw "Node.js 18+ required. Found Node major: $nodeMajor" } 21 22 if (-not (Test-Path ".\\node_modules")) { 23 Write-Host "[Bzl] Installing dependencies..." -ForegroundColor Yellow 24 npm.cmd install 25 if ($LASTEXITCODE -ne 0) { throw "npm install failed (exit $LASTEXITCODE)" } 26 } 27 28 Write-Host "[Bzl] Running init wizard..." -ForegroundColor Yellow 29 npm.cmd run init 30 if ($LASTEXITCODE -ne 0) { throw "init failed (exit $LASTEXITCODE)" } 31 32 Write-Host "" 33 Write-Host "[Bzl] Start now with:" -ForegroundColor Green 34 Write-Host " npm.cmd start" 35 Write-Host "" 36 Write-Host "Or supervised (auto-restart):" 37 Write-Host " npm.cmd run start:supervised" 38 39 Write-Host "" 40 Write-Host "[Bzl] Tip: For one-click launch on Windows, use INSTALL.cmd then LAUNCH.cmd." -ForegroundColor DarkGray 41 42 Write-Host "" 43 Read-Host "Press Enter to close"