Files
termi-blog/dev.ps1

61 lines
1.6 KiB
PowerShell

param(
[switch]$FrontendOnly,
[switch]$BackendOnly,
[switch]$McpOnly,
[switch]$WithMcp,
[string]$DatabaseUrl = "postgres://postgres:postgres%402025%21@10.0.0.2:5432/termi-api_development"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$frontendScript = Join-Path $repoRoot "start-frontend.ps1"
$backendScript = Join-Path $repoRoot "start-backend.ps1"
$mcpScript = Join-Path $repoRoot "start-mcp.ps1"
if (@($FrontendOnly, $BackendOnly, $McpOnly).Where({ $_ }).Count -gt 1) {
throw "Use only one of -FrontendOnly, -BackendOnly, or -McpOnly."
}
if ($FrontendOnly) {
& $frontendScript
exit $LASTEXITCODE
}
if ($BackendOnly) {
& $backendScript -DatabaseUrl $DatabaseUrl
exit $LASTEXITCODE
}
if ($McpOnly) {
& $mcpScript
exit $LASTEXITCODE
}
$services = if ($WithMcp) { "frontend, backend, and MCP" } else { "frontend and backend" }
Write-Host "[monorepo] Starting $services in separate PowerShell windows..." -ForegroundColor Cyan
Start-Process powershell -ArgumentList @(
"-NoExit",
"-ExecutionPolicy", "Bypass",
"-File", $frontendScript
)
Start-Process powershell -ArgumentList @(
"-NoExit",
"-ExecutionPolicy", "Bypass",
"-File", $backendScript,
"-DatabaseUrl", $DatabaseUrl
)
if ($WithMcp) {
Start-Process powershell -ArgumentList @(
"-NoExit",
"-ExecutionPolicy", "Bypass",
"-File", $mcpScript
)
}
$servicesStarted = if ($WithMcp) { "Frontend, backend, and MCP windows started." } else { "Frontend window and backend window started." }
Write-Host "[monorepo] $servicesStarted" -ForegroundColor Green