forked from bluewave-labs/Checkmate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-build.ps1
More file actions
99 lines (89 loc) · 3.3 KB
/
Copy pathverify-build.ps1
File metadata and controls
99 lines (89 loc) · 3.3 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Pre-Commit Verification Script for Windows
# Run this before committing to ensure everything works
Write-Host "CheckmateX Pre-Commit Verification" -ForegroundColor Cyan
Write-Host "===================================`n" -ForegroundColor Cyan
$errors = 0
# Test 1: Check if Docker is running
Write-Host "[1/6] Checking Docker..." -ForegroundColor Yellow
try {
docker info | Out-Null
Write-Host " ✓ Docker is running" -ForegroundColor Green
} catch {
Write-Host " ✗ Docker is not running or not installed" -ForegroundColor Red
$errors++
}
# Test 2: Check if pnpm is installed
Write-Host "`n[2/6] Checking pnpm..." -ForegroundColor Yellow
try {
pnpm --version | Out-Null
Write-Host " ✓ pnpm is installed" -ForegroundColor Green
} catch {
Write-Host " ✗ pnpm is not installed" -ForegroundColor Red
Write-Host " Install with: npm install -g pnpm" -ForegroundColor Yellow
$errors++
}
# Test 3: Check Node.js version
Write-Host "`n[3/6] Checking Node.js version..." -ForegroundColor Yellow
$nodeVersion = node --version
if ($nodeVersion -match "v(\d+)") {
$majorVersion = [int]$matches[1]
if ($majorVersion -ge 18) {
Write-Host " ✓ Node.js $nodeVersion (meets requirement: >= 18)" -ForegroundColor Green
} else {
Write-Host " ✗ Node.js $nodeVersion (requires >= 18)" -ForegroundColor Red
$errors++
}
}
# Test 4: Build client
Write-Host "`n[4/6] Building client..." -ForegroundColor Yellow
Set-Location client
pnpm install --silent
$clientBuild = pnpm build 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " ✓ Client builds successfully" -ForegroundColor Green
} else {
Write-Host " ✗ Client build failed" -ForegroundColor Red
Write-Host $clientBuild -ForegroundColor Red
$errors++
}
Set-Location ..
# Test 5: Build server
Write-Host "`n[5/6] Building server..." -ForegroundColor Yellow
Set-Location server
pnpm install --silent
$serverBuild = pnpm build 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " ✓ Server builds successfully" -ForegroundColor Green
} else {
Write-Host " ✗ Server build failed" -ForegroundColor Red
Write-Host $serverBuild -ForegroundColor Red
$errors++
}
Set-Location ..
# Test 6: Verify Docker build script exists
Write-Host "`n[6/6] Verifying Docker build scripts..." -ForegroundColor Yellow
$bashScript = Test-Path "docker/dev/build_images.sh"
$psScript = Test-Path "docker/dev/build_images.ps1"
if ($bashScript -and $psScript) {
Write-Host " ✓ Both bash and PowerShell build scripts exist" -ForegroundColor Green
} else {
if (-not $bashScript) {
Write-Host " ✗ docker/dev/build_images.sh not found" -ForegroundColor Red
$errors++
}
if (-not $psScript) {
Write-Host " ✗ docker/dev/build_images.ps1 not found" -ForegroundColor Red
$errors++
}
}
# Summary
Write-Host "`n========================================" -ForegroundColor Cyan
if ($errors -eq 0) {
Write-Host "✓ All checks passed! Ready to commit." -ForegroundColor Green
Write-Host "`nOptional: Test Docker build (takes ~5-10 minutes):" -ForegroundColor Cyan
Write-Host " cd docker/dev" -ForegroundColor White
Write-Host " .\build_images.ps1" -ForegroundColor White
} else {
Write-Host "✗ $errors check(s) failed. Fix issues before committing." -ForegroundColor Red
exit 1
}