Add scripts/dev-up.ps1 to launch the whole local dev stack
Single command brings up Postgres (via dev-db.ps1), the backend API, and the Vite frontend. API and frontend each get their own PowerShell window so logs do not interleave and Ctrl+C only kills the intended process. Email links print to the API window via LoggingEmailSender.
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Bring up the full local dev stack: Postgres + backend API + Vite frontend.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Starts the dev Postgres container (via dev-db.ps1), then spawns the API and
|
||||||
|
frontend in their own PowerShell windows so each keeps its own scrollback
|
||||||
|
and Ctrl+C only kills the intended process. The API log window is where
|
||||||
|
invite/reset email links print (LoggingEmailSender output).
|
||||||
|
|
||||||
|
Stop everything by closing the two spawned windows. The DB stays up across
|
||||||
|
runs; use './scripts/dev-db.ps1 stop' or 'reset' to manage it explicitly.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
./scripts/dev-up.ps1
|
||||||
|
#>
|
||||||
|
param()
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$RepoRoot = Resolve-Path "$PSScriptRoot/.."
|
||||||
|
|
||||||
|
# 1. Database
|
||||||
|
& "$PSScriptRoot/dev-db.ps1" start
|
||||||
|
|
||||||
|
# 2. Backend API. Tag the window title so it's easy to find when stopping.
|
||||||
|
Write-Host "Launching backend in a new window..." -ForegroundColor Cyan
|
||||||
|
Start-Process pwsh -ArgumentList @(
|
||||||
|
'-NoExit',
|
||||||
|
'-Command',
|
||||||
|
"`$Host.UI.RawUI.WindowTitle = 'YesChef API'; dotnet run --project '$RepoRoot/src/backend/YesChef.Api'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 3. Frontend (Vite dev server, with the existing /api + /hubs proxy).
|
||||||
|
Write-Host "Launching frontend in a new window..." -ForegroundColor Cyan
|
||||||
|
Start-Process pwsh -ArgumentList @(
|
||||||
|
'-NoExit',
|
||||||
|
'-Command',
|
||||||
|
"`$Host.UI.RawUI.WindowTitle = 'YesChef Frontend'; npm --prefix '$RepoRoot/src/frontend' run dev"
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Stack is starting. URLs:" -ForegroundColor Green
|
||||||
|
Write-Host " Frontend: http://localhost:5173"
|
||||||
|
Write-Host " API : http://localhost:5291"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Invite and password-reset links print to the API window (LoggingEmailSender)."
|
||||||
|
Write-Host "Close the two spawned windows to stop. DB remains up; manage with scripts/dev-db.ps1."
|
||||||
Reference in New Issue
Block a user