Files
iistwin/scripts/dev/start-dev.ps1

39 lines
1.3 KiB
PowerShell

# Start the CRM app in native development mode on Windows.
# Dependencies must already be running (see start-deps.sh / docker-compose.deps.yml).
# Usage: .\scripts\dev\start-dev.ps1
$ErrorActionPreference = "Stop"
$ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
Set-Location $ProjectRoot
if (-not (Test-Path ".env.local")) {
Write-Error "ERROR: .env.local not found."
exit 1
}
# Load environment variables from .env.local
Get-Content ".env.local" | ForEach-Object {
$line = $_.Trim()
if ($line -and -not $line.StartsWith("#")) {
$idx = $line.IndexOf("=")
if ($idx -gt 0) {
$key = $line.Substring(0, $idx).Trim()
$value = $line.Substring($idx + 1).Trim()
# Remove surrounding quotes if present
if ($value.StartsWith('"') -and $value.EndsWith('"')) {
$value = $value.Substring(1, $value.Length - 2)
}
[Environment]::SetEnvironmentVariable($key, $value, "Process")
}
}
}
$env:NODE_ENV = "development"
Write-Host "=== Starting CRM dev server ==="
Write-Host "Make sure dependencies are running: docker compose --env-file .env.local -f docker-compose.deps.yml -p crm-local up -d"
Write-Host ""
& .\node_modules\.bin\tsx server\index.ts