chore: add root startup scripts
This commit is contained in:
33
start-frontend.ps1
Normal file
33
start-frontend.ps1
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user