-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.ps1
More file actions
83 lines (66 loc) · 2.76 KB
/
Copy pathstart.ps1
File metadata and controls
83 lines (66 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# AccessClone - Start Application
# Starts the backend server and optionally the UI dev server
#
# Usage: .\start.ps1 -Password <your_pg_password>
# .\start.ps1 -Password <your_pg_password> -Dev # Also starts UI dev server
param(
[Parameter(Mandatory=$true)]
[string]$Password,
[switch]$Dev,
[switch]$NoBrowser
)
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "AccessClone - Starting Application" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Set environment variables
$env:PGPASSWORD = $Password
# Get paths
$serverPath = Join-Path $PSScriptRoot "server"
$uiPath = Join-Path $PSScriptRoot "ui"
# Start backend server
Write-Host "Starting backend server..." -ForegroundColor Yellow
$serverProcess = Start-Process -FilePath "node" -ArgumentList "index.js" -WorkingDirectory $serverPath -PassThru -NoNewWindow
Write-Host "Backend server started (PID: $($serverProcess.Id))" -ForegroundColor Green
Write-Host "API available at: http://localhost:3001" -ForegroundColor Gray
if ($Dev) {
# Start UI development server
Write-Host ""
Write-Host "Starting UI development server..." -ForegroundColor Yellow
$uiProcess = Start-Process -FilePath "npx" -ArgumentList "shadow-cljs", "watch", "app" -WorkingDirectory $uiPath -PassThru -NoNewWindow
Write-Host "UI dev server started (PID: $($uiProcess.Id))" -ForegroundColor Green
Write-Host "UI available at: http://localhost:8080" -ForegroundColor Gray
$url = "http://localhost:8080"
} else {
# Serve static files (production mode)
$url = "http://localhost:3001"
Write-Host ""
Write-Host "Running in production mode (pre-built UI)" -ForegroundColor Gray
Write-Host "Use -Dev flag to start UI development server" -ForegroundColor Gray
}
Write-Host ""
# Open browser
if (-not $NoBrowser) {
Write-Host "Opening browser..." -ForegroundColor Yellow
Start-Sleep -Seconds 2 # Give server time to start
Start-Process $url
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Application running!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Press Ctrl+C to stop the server" -ForegroundColor Gray
Write-Host ""
# Wait for server process
try {
$serverProcess.WaitForExit()
} finally {
# Cleanup
$env:PGPASSWORD = $null
if ($Dev -and $uiProcess -and -not $uiProcess.HasExited) {
Write-Host "Stopping UI server..." -ForegroundColor Yellow
Stop-Process -Id $uiProcess.Id -Force -ErrorAction SilentlyContinue
}
}