-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.ps1
More file actions
72 lines (61 loc) · 2.5 KB
/
setup.ps1
File metadata and controls
72 lines (61 loc) · 2.5 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
# PortOS Setup Script for Windows PowerShell
$ErrorActionPreference = "Stop"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " PortOS Setup" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
Write-Host ""
# Check for Node.js
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
if (-not $nodeCommand) {
Write-Host "Node.js is required but not installed." -ForegroundColor Red
Write-Host "Install it from: https://nodejs.org/" -ForegroundColor Yellow
exit 1
}
# Check Node.js version
$nodeVersion = (node -v) -replace 'v', ''
$majorVersion = [int]($nodeVersion.Split('.')[0])
if ($majorVersion -lt 18) {
Write-Host "Node.js 18+ required (found v$nodeVersion)" -ForegroundColor Red
exit 1
}
Write-Host "Found Node.js v$nodeVersion" -ForegroundColor Green
# Install dependencies
Write-Host ""
Write-Host "Installing dependencies..." -ForegroundColor Yellow
Write-Host " Installing root dependencies..."
npm install
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host " Installing client dependencies..."
Push-Location client
npm install
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
Pop-Location
Write-Host " Installing server dependencies..."
Push-Location server
npm install
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
Pop-Location
# Run setup scripts
Write-Host ""
Write-Host "Setting up data directory..." -ForegroundColor Yellow
npm run setup
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host ""
# Optional Ghostty setup
$setupGhostty = Read-Host "Set up Ghostty terminal themes? (y/N)"
if ($setupGhostty -match '^[Yy]$') {
node scripts/setup-ghostty.js
}
Write-Host ""
Write-Host "===================================" -ForegroundColor Green
Write-Host " Setup Complete!" -ForegroundColor Green
Write-Host "===================================" -ForegroundColor Green
Write-Host ""
Write-Host "Start PortOS:"
Write-Host " Development: " -NoNewline; Write-Host "npm run dev" -ForegroundColor Cyan
Write-Host " Production: " -NoNewline; Write-Host "npm start" -ForegroundColor Cyan; Write-Host " (or npm run pm2:start)" -NoNewline -ForegroundColor Gray; Write-Host ""
Write-Host " Stop: " -NoNewline; Write-Host "npm run pm2:stop" -ForegroundColor Cyan
Write-Host " Logs: " -NoNewline; Write-Host "npm run pm2:logs" -ForegroundColor Cyan
Write-Host ""
Write-Host "Access at: " -NoNewline; Write-Host "http://localhost:5555" -ForegroundColor Yellow
Write-Host ""