34 lines
705 B
PowerShell
34 lines
705 B
PowerShell
param(
|
|
[switch]$Install
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$adminDir = Join-Path $repoRoot "admin"
|
|
|
|
if (-not (Test-Path $adminDir)) {
|
|
throw "Admin directory not found: $adminDir"
|
|
}
|
|
|
|
Push-Location $adminDir
|
|
|
|
try {
|
|
if ($Install -or -not (Test-Path (Join-Path $adminDir "node_modules"))) {
|
|
Write-Host "[admin] Installing dependencies..." -ForegroundColor Cyan
|
|
npm install
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "npm install failed"
|
|
}
|
|
}
|
|
|
|
Write-Host "[admin] Starting Vite admin workspace..." -ForegroundColor Green
|
|
npm run dev
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "npm run dev failed"
|
|
}
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|