chore: add root startup scripts

This commit is contained in:
2026-03-28 10:53:29 +08:00
parent 1455d93246
commit d18a709987
4 changed files with 129 additions and 0 deletions

33
start-frontend.ps1 Normal file
View File

@@ -0,0 +1,33 @@
param(
[switch]$Install
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$frontendDir = Join-Path $repoRoot "frontend"
if (-not (Test-Path $frontendDir)) {
throw "Frontend directory not found: $frontendDir"
}
Push-Location $frontendDir
try {
if ($Install -or -not (Test-Path (Join-Path $frontendDir "node_modules"))) {
Write-Host "[frontend] Installing dependencies..." -ForegroundColor Cyan
npm install
if ($LASTEXITCODE -ne 0) {
throw "npm install failed"
}
}
Write-Host "[frontend] Starting Astro dev server..." -ForegroundColor Green
npm run dev
if ($LASTEXITCODE -ne 0) {
throw "npm run dev failed"
}
}
finally {
Pop-Location
}