Files
sillytavern-repalice/start-dev.ps1
2026-04-26 03:34:47 +08:00

39 lines
1.7 KiB
PowerShell

# Local Development Environment Starter (PowerShell)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Starting Local Development Environment" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check if node_modules exist
if (-Not (Test-Path "node_modules")) {
Write-Host "Installing dependencies..." -ForegroundColor Yellow
npm install
Write-Host ""
}
Write-Host "Starting Backend Server (NestJS)..." -ForegroundColor Yellow
$backendProcess = Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd server; npm run start:dev" -PassThru -WindowStyle Normal
Start-Sleep -Seconds 3
Write-Host "Starting Frontend Server (Vite)..." -ForegroundColor Yellow
$frontendProcess = Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd client; npm run dev" -PassThru -WindowStyle Normal
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "Development servers are starting..." -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "Backend: http://localhost:3000" -ForegroundColor White
Write-Host "Frontend: http://localhost:5173" -ForegroundColor White
Write-Host ""
Write-Host "Press any key to stop all servers..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host "Stopping servers..." -ForegroundColor Yellow
Stop-Process -Id $backendProcess.Id -Force -ErrorAction SilentlyContinue
Stop-Process -Id $frontendProcess.Id -Force -ErrorAction SilentlyContinue
Write-Host "Servers stopped." -ForegroundColor Green