haraps 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +9 -1
- package/bin/index.js +1381 -375
- package/deploy.ps1 +414 -0
- package/deploy.sh +10 -0
- package/dev.ps1 +409 -0
- package/dev.sh +359 -0
- package/package.json +1 -1
package/deploy.ps1
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[switch]$SkipSentry = $false,
|
|
3
|
+
[switch]$SkipSeed = $false,
|
|
4
|
+
[switch]$SkipApp = $false,
|
|
5
|
+
[switch]$SkipRouter = $false,
|
|
6
|
+
[switch]$SkipFrontend = $false,
|
|
7
|
+
[switch]$SkipDBSync = $false,
|
|
8
|
+
[switch]$SkipVisual = $false,
|
|
9
|
+
[switch]$Fast = $false
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
if ($Fast) {
|
|
13
|
+
Write-Host "[FAST] Fast mode enabled. Skipping DB, Router, and App releases." -ForegroundColor Cyan
|
|
14
|
+
$SkipSeed = $true
|
|
15
|
+
$SkipApp = $true
|
|
16
|
+
$SkipRouter = $true
|
|
17
|
+
$SkipFrontend = $false
|
|
18
|
+
$SkipSentry = $true
|
|
19
|
+
$SkipDBSync = $true
|
|
20
|
+
$SkipVisual = $true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Medizys Modernized Deployment Script
|
|
24
|
+
# Features: Schema Sync, Consolidated Reporting, Timestamped Logs, Clipboard Integration
|
|
25
|
+
|
|
26
|
+
$ErrorActionPreference = 'Stop'
|
|
27
|
+
|
|
28
|
+
# Ensure we are in the root of the project
|
|
29
|
+
Set-Location $PSScriptRoot
|
|
30
|
+
|
|
31
|
+
# Load .env and .env.local files if present
|
|
32
|
+
$envFiles = @(".env", ".env.local", "frontend\.env.local")
|
|
33
|
+
foreach ($file in $envFiles) {
|
|
34
|
+
$envFile = Join-Path $PSScriptRoot $file
|
|
35
|
+
if (Test-Path $envFile) {
|
|
36
|
+
Write-Host "[RESILIENCE] Loading environment variables from $file..." -ForegroundColor Cyan
|
|
37
|
+
Get-Content $envFile | Where-Object { $_ -match '^\s*([^#\s][^=]+)=(.*)' } | ForEach-Object {
|
|
38
|
+
$name = $matches[1].Trim()
|
|
39
|
+
$value = $matches[2].Trim()
|
|
40
|
+
if ($value -match '^"(.*)"$') { $value = $matches[1] }
|
|
41
|
+
elseif ($value -match "^'(.*)'$") { $value = $matches[1] }
|
|
42
|
+
[Environment]::SetEnvironmentVariable($name, $value, "Process")
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# PROACTIVE COLLISION PREVENTION: Kill competing deployment tasks to prevent file locks
|
|
48
|
+
Write-Host "[RESILIENCE] Terminating conflicting build processes to prevent locks..." -ForegroundColor Yellow
|
|
49
|
+
$conflictingProcs = Get-WmiObject Win32_Process | Where-Object {
|
|
50
|
+
$_.Name -match 'node.exe' -and
|
|
51
|
+
($_.CommandLine -match 'next build' -or $_.CommandLine -match 'tsc' -or $_.CommandLine -match 'wrangler deploy')
|
|
52
|
+
}
|
|
53
|
+
foreach ($p in $conflictingProcs) {
|
|
54
|
+
Stop-Process -Id $p.ProcessId -Force -ErrorAction SilentlyContinue
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
$GlobalReport = [PSCustomObject]@{
|
|
58
|
+
StartTime = (Get-Date)
|
|
59
|
+
Status = "Running"
|
|
60
|
+
Steps = @()
|
|
61
|
+
Error = $null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Create reports directory in root
|
|
65
|
+
$ReportsDir = Join-Path $PSScriptRoot "deployment_reports"
|
|
66
|
+
if (!(Test-Path $ReportsDir)) { New-Item -ItemType Directory -Path $ReportsDir | Out-Null }
|
|
67
|
+
|
|
68
|
+
function Add-Step {
|
|
69
|
+
param([string]$Name, [string]$Status, [string]$Details = "")
|
|
70
|
+
$GlobalReport.Steps += [PSCustomObject]@{
|
|
71
|
+
Name = $Name
|
|
72
|
+
Status = $Status
|
|
73
|
+
Details = $Details
|
|
74
|
+
Time = (Get-Date).ToString("T")
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function Generate-FinalReport {
|
|
79
|
+
param([string]$FinalStatus)
|
|
80
|
+
$GlobalReport.Status = $FinalStatus
|
|
81
|
+
|
|
82
|
+
# Get IP and IST Time
|
|
83
|
+
$ipStr = "Unknown"
|
|
84
|
+
try { $ipStr = (Invoke-RestMethod -Uri 'https://api.ipify.org' -TimeoutSec 3).Trim() } catch { }
|
|
85
|
+
|
|
86
|
+
$istTimeZone = [System.TimeZoneInfo]::FindSystemTimeZoneById("India Standard Time")
|
|
87
|
+
$istStartTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($GlobalReport.StartTime.ToUniversalTime(), $istTimeZone)
|
|
88
|
+
|
|
89
|
+
$reportText = "=================================================`n"
|
|
90
|
+
$reportText += "MEDIQUEUE DEPLOYMENT REPORT`n"
|
|
91
|
+
$reportText += "=================================================`n"
|
|
92
|
+
$reportText += "Status: $FinalStatus`n"
|
|
93
|
+
$reportText += "IP: $ipStr`n"
|
|
94
|
+
$reportText += "Timestamp: $($istStartTime.ToString('MM/dd/yyyy HH:mm:ss')) (IST)`n"
|
|
95
|
+
$reportText += "Duration: $((Get-Date) - $GlobalReport.StartTime)`n"
|
|
96
|
+
$reportText += "-------------------------------------------------`n"
|
|
97
|
+
|
|
98
|
+
foreach ($step in $GlobalReport.Steps) {
|
|
99
|
+
$indicator = if ($step.Status -eq "SUCCESS") { "[OK]" } else { "[FAIL]" }
|
|
100
|
+
$reportText += "$indicator [$($step.Time)] $($step.Name): $($step.Status)`n"
|
|
101
|
+
if ($step.Details) { $reportText += " > $($step.Details)`n" }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if ($GlobalReport.Error) {
|
|
105
|
+
$reportText += "-------------------------------------------------`n"
|
|
106
|
+
$reportText += "CRITICAL ERROR:`n$($GlobalReport.Error)`n"
|
|
107
|
+
}
|
|
108
|
+
$reportText += "=================================================`n"
|
|
109
|
+
|
|
110
|
+
# Save to file
|
|
111
|
+
$statusIndicator = if ($FinalStatus -eq "SUCCESS") { "SUCCESS" } else { "FAILED" }
|
|
112
|
+
$hour = (Get-Date).Hour
|
|
113
|
+
$timeOfDay = if ($hour -ge 5 -and $hour -lt 12) { "Morning" }
|
|
114
|
+
elseif ($hour -ge 12 -and $hour -lt 17) { "Afternoon" }
|
|
115
|
+
elseif ($hour -ge 17 -and $hour -lt 21) { "Evening" }
|
|
116
|
+
else { "Night" }
|
|
117
|
+
|
|
118
|
+
$humanTime = (Get-Date).ToString("ddMMM_hh-mmtt") # e.g. 30Mar_02-30PM
|
|
119
|
+
$fileName = "Deploy_${statusIndicator}_${timeOfDay}_$humanTime.txt"
|
|
120
|
+
$filePath = Join-Path $ReportsDir $fileName
|
|
121
|
+
$reportText | Out-File -FilePath $filePath
|
|
122
|
+
|
|
123
|
+
# Copy to clipboard
|
|
124
|
+
try { $reportText | Set-Clipboard } catch {}
|
|
125
|
+
|
|
126
|
+
return $reportText
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function Send-Notification {
|
|
130
|
+
param([string]$Status, [string]$Report)
|
|
131
|
+
try {
|
|
132
|
+
Write-Host "[NOTIF] Dispatching deployment pulse..." -ForegroundColor Magenta
|
|
133
|
+
$notifPayload = (@{
|
|
134
|
+
version = "v2.5.2-stable"
|
|
135
|
+
env = "production"
|
|
136
|
+
status = $Status
|
|
137
|
+
report = $Report
|
|
138
|
+
chatId = "-1003863805343"
|
|
139
|
+
} | ConvertTo-Json)
|
|
140
|
+
|
|
141
|
+
Invoke-RestMethod -Uri "https://api.mediqueue.hara-xy.com/api/platform/notif/deploy" -Method Post -Body $notifPayload -Headers @{ "X-Requested-With" = "XMLHttpRequest" } -ContentType "application/json"
|
|
142
|
+
Write-Host "Dispatch confirmed." -ForegroundColor Green
|
|
143
|
+
} catch {
|
|
144
|
+
Write-Host "Notification dispatch failed." -ForegroundColor Yellow
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function Send-AntigravityChat {
|
|
149
|
+
param([string]$Status, [string]$Report)
|
|
150
|
+
try {
|
|
151
|
+
Write-Host "[ANTIGRAVITY] Sending deployment report to chat..." -ForegroundColor Magenta
|
|
152
|
+
$emoji = if ($Status -eq "SUCCESS") { "✅" } else { "❌" }
|
|
153
|
+
$chatMessage = "$emoji Medizys Deployment $Status`n`n$Report"
|
|
154
|
+
|
|
155
|
+
# Append newline so the Antigravity Bridge auto-submits the message
|
|
156
|
+
$payload = @{ text = "$chatMessage`n" } | ConvertTo-Json
|
|
157
|
+
|
|
158
|
+
Invoke-RestMethod `
|
|
159
|
+
-Uri "http://localhost:5000/send_command" `
|
|
160
|
+
-Method Post `
|
|
161
|
+
-Body $payload `
|
|
162
|
+
-ContentType "application/json" `
|
|
163
|
+
-ErrorAction SilentlyContinue | Out-Null
|
|
164
|
+
|
|
165
|
+
Write-Host "[ANTIGRAVITY] Report dispatched to chat." -ForegroundColor Green
|
|
166
|
+
} catch {
|
|
167
|
+
Write-Host "[ANTIGRAVITY] Chat dispatch skipped (bridge not running)." -ForegroundColor DarkGray
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function Invoke-ModernCommand {
|
|
172
|
+
param([string]$Step, [scriptblock]$Script, [switch]$NoExit)
|
|
173
|
+
Write-Host ""
|
|
174
|
+
Write-Host "[STEP] $($Step)..." -ForegroundColor Yellow
|
|
175
|
+
try {
|
|
176
|
+
# Execute script correctly
|
|
177
|
+
$global:LASTEXITCODE = 0
|
|
178
|
+
& $Script
|
|
179
|
+
$exitCode = $LASTEXITCODE
|
|
180
|
+
|
|
181
|
+
if ($exitCode -eq 0) {
|
|
182
|
+
Add-Step $Step "SUCCESS"
|
|
183
|
+
Write-Host "[OK] $Step completed successfully." -ForegroundColor Green
|
|
184
|
+
} else {
|
|
185
|
+
throw "Command failed with exit code $exitCode."
|
|
186
|
+
}
|
|
187
|
+
} catch {
|
|
188
|
+
$errorMsg = $_.ToString()
|
|
189
|
+
Add-Step $Step "FAILED" "Critical Error: See Global Report"
|
|
190
|
+
$GlobalReport.Error = "Step: $Step`nError: $errorMsg"
|
|
191
|
+
|
|
192
|
+
if ($NoExit) {
|
|
193
|
+
Write-Host "[WARN] $Step failed, but continuing (NoExit enabled)." -ForegroundColor Yellow
|
|
194
|
+
throw $errorMsg
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
$finalReport = Generate-FinalReport "FAILED"
|
|
198
|
+
|
|
199
|
+
# Send failure notification
|
|
200
|
+
Send-Notification -Status "FAILED" -Report $finalReport
|
|
201
|
+
Send-AntigravityChat -Status "FAILED" -Report $finalReport
|
|
202
|
+
|
|
203
|
+
Write-Host ""
|
|
204
|
+
Write-Host "DEPLOYMENT FAILED!" -ForegroundColor Red
|
|
205
|
+
Write-Host "-------------------------------------------------"
|
|
206
|
+
Write-Host $errorMsg -ForegroundColor Gray
|
|
207
|
+
Write-Host "-------------------------------------------------"
|
|
208
|
+
Write-Host "[CLIPBOARD] Full error report copied to your clipboard!" -ForegroundColor Cyan
|
|
209
|
+
|
|
210
|
+
# Ensure we return to root before exiting
|
|
211
|
+
Set-Location $PSScriptRoot
|
|
212
|
+
exit 1
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
# Phase -1: Security Audits & Clean Install
|
|
217
|
+
Invoke-ModernCommand "Lockfile Linting" { pnpm run lint:lockfile }
|
|
218
|
+
Invoke-ModernCommand "Clean Installation (Strict Lockfile)" { pnpm install --frozen-lockfile }
|
|
219
|
+
|
|
220
|
+
# Phase 0: Pre-flight Sync
|
|
221
|
+
Invoke-ModernCommand "Sync Frontend Routes" { node "$PSScriptRoot\scripts\sync-routes.js" }
|
|
222
|
+
Invoke-ModernCommand "Sync Shared Types" { Copy-Item "$PSScriptRoot\worker\src\shared-types.ts" "$PSScriptRoot\frontend\lib\shared-types.ts" -Force }
|
|
223
|
+
Invoke-ModernCommand "Worker ESLint Audit" { pnpm --filter mediqueue-worker run lint }
|
|
224
|
+
|
|
225
|
+
# Phase 1 & 2: Worker
|
|
226
|
+
try {
|
|
227
|
+
Push-Location worker
|
|
228
|
+
# Database Schema Sync (using latest Drizzle patterns)
|
|
229
|
+
if (!$SkipDBSync) {
|
|
230
|
+
Invoke-ModernCommand "Database Enum Drift Audit" { pnpm run db:audit }
|
|
231
|
+
Invoke-ModernCommand "Database Migrations (HTTP)" { pnpm run db:migrate }
|
|
232
|
+
Invoke-ModernCommand "Worker Type Check" { pnpm run typecheck }
|
|
233
|
+
} else {
|
|
234
|
+
Write-Host "[SKIP] Database Schema Sync skipped." -ForegroundColor Gray
|
|
235
|
+
Add-Step "Database Enum Drift Audit" "SKIPPED"
|
|
236
|
+
Add-Step "Database Schema Sync" "SKIPPED"
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
# Seed initial data (Achievements, etc.)
|
|
240
|
+
if (!$SkipSeed) {
|
|
241
|
+
Invoke-ModernCommand "Database Seeding" { pnpm run db:seed }
|
|
242
|
+
} else {
|
|
243
|
+
Write-Host "[SKIP] Database Seeding skipped." -ForegroundColor Gray
|
|
244
|
+
Add-Step "Database Seeding" "SKIPPED"
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
# Phase 2: Worker Deployment
|
|
248
|
+
if ($SkipSentry) {
|
|
249
|
+
Invoke-ModernCommand "Worker Deployment (Fast)" { pnpm run deploy:fast }
|
|
250
|
+
} else {
|
|
251
|
+
try {
|
|
252
|
+
Invoke-ModernCommand "Worker Deployment (Sentry)" { pnpm run deploy:sentry } -NoExit
|
|
253
|
+
} catch {
|
|
254
|
+
Write-Host "[WARN] Sentry deployment failed (likely timeout or config). Falling back to fast deploy..." -ForegroundColor Yellow
|
|
255
|
+
Invoke-ModernCommand "Worker Deployment (Fallback)" { pnpm run deploy:fast }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} finally {
|
|
259
|
+
Pop-Location
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
# Phase 2.5: Router Worker Deployment
|
|
263
|
+
if (!$SkipRouter) {
|
|
264
|
+
try {
|
|
265
|
+
Push-Location router-worker
|
|
266
|
+
Invoke-ModernCommand "Router Worker Deployment" { npx wrangler@4.80.0 deploy }
|
|
267
|
+
} finally {
|
|
268
|
+
Pop-Location
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
Write-Host "[SKIP] Router Worker Deployment skipped." -ForegroundColor Gray
|
|
272
|
+
Add-Step "Router Worker Deployment" "SKIPPED"
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
# Phase 3: Frontend Deployment
|
|
276
|
+
if (!$SkipFrontend) {
|
|
277
|
+
|
|
278
|
+
try {
|
|
279
|
+
Push-Location frontend
|
|
280
|
+
$env:NODE_OPTIONS = "--max-old-space-size=8192"
|
|
281
|
+
Write-Host "Cleaning previous build artifacts..." -ForegroundColor Gray
|
|
282
|
+
|
|
283
|
+
# PROACTIVE LOCK CLEANUP: Remove .next/lock if it exists to prevent build timeouts
|
|
284
|
+
$lockFile = Join-Path (Get-Location) ".next\lock"
|
|
285
|
+
if (Test-Path $lockFile) {
|
|
286
|
+
Write-Host "[RESILIENCE] Removing stale .next/lock..." -ForegroundColor Yellow
|
|
287
|
+
Remove-Item -Force $lockFile -ErrorAction SilentlyContinue
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (!$Fast) {
|
|
291
|
+
Write-Host "Cleaning previous build artifacts (Full Mode)..." -ForegroundColor Gray
|
|
292
|
+
if (Test-Path out) { Remove-Item -Recurse -Force out -ErrorAction SilentlyContinue }
|
|
293
|
+
} else {
|
|
294
|
+
Write-Host "Preserving build cache for faster iterations (Fast Mode)..." -ForegroundColor Cyan
|
|
295
|
+
if (Test-Path out) { Remove-Item -Recurse -Force out -ErrorAction SilentlyContinue }
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
# Generate Deployment Versioning for Awareness
|
|
299
|
+
$deployId = (Get-Date).ToString("yyyyMMddHHmmss")
|
|
300
|
+
$versionJson = @{
|
|
301
|
+
version = "v2.5.2-stable"
|
|
302
|
+
deployId = $deployId
|
|
303
|
+
timestamp = (Get-Date).ToString("o")
|
|
304
|
+
notes = "Portal boundaries and operational context audit."
|
|
305
|
+
} | ConvertTo-Json
|
|
306
|
+
$versionJson | Out-File -FilePath "public/version.json" -Encoding utf8
|
|
307
|
+
Write-Host "[OK] Deployment version $deployId generated." -ForegroundColor Green
|
|
308
|
+
|
|
309
|
+
Invoke-ModernCommand "Frontend Type Check" { pnpm run typecheck }
|
|
310
|
+
|
|
311
|
+
if (!$SkipVisual) {
|
|
312
|
+
Write-Host "`n[STEP] Frontend Visual Tests..." -ForegroundColor Yellow
|
|
313
|
+
$global:LASTEXITCODE = 0
|
|
314
|
+
& pnpm run test:visual
|
|
315
|
+
if ($global:LASTEXITCODE -eq 0) {
|
|
316
|
+
Add-Step "Frontend Visual Tests" "SUCCESS"
|
|
317
|
+
Write-Host "[OK] Frontend Visual Tests completed successfully." -ForegroundColor Green
|
|
318
|
+
} else {
|
|
319
|
+
Add-Step "Frontend Visual Tests" "FAILED (Ignored)"
|
|
320
|
+
Write-Host "[WARN] Frontend Visual Tests failed, but continuing deployment as requested." -ForegroundColor Yellow
|
|
321
|
+
$global:LASTEXITCODE = 0
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
Write-Host "[SKIP] Frontend Visual Tests skipped." -ForegroundColor Gray
|
|
325
|
+
Add-Step "Frontend Visual Tests" "SKIPPED"
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
Invoke-ModernCommand "Frontend Build" { pnpm run build }
|
|
329
|
+
|
|
330
|
+
Write-Host "[RESILIENCE] Ensuring hidden public assets (e.g. .well-known) are copied to out..." -ForegroundColor Gray
|
|
331
|
+
if (Test-Path "public\.well-known") {
|
|
332
|
+
if (!(Test-Path "out\.well-known")) {
|
|
333
|
+
New-Item -ItemType Directory -Path "out\.well-known" | Out-Null
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
Copy-Item -Recurse -Force "public\.well-known\*" "out\.well-known" -ErrorAction Stop
|
|
337
|
+
} catch {
|
|
338
|
+
Write-Host "[WARN] Could not copy .well-known: $($_.Exception.Message)" -ForegroundColor Yellow
|
|
339
|
+
}
|
|
340
|
+
Write-Host "[RESILIENCE] Copied .well-known to out directory." -ForegroundColor Green
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (!(Test-Path "out\index.html")) { New-Item -Path "out\index.html" -ItemType File -Force | Out-Null }
|
|
344
|
+
Invoke-ModernCommand "Mobile App Sync (Capacitor)" { pnpm exec cap sync }
|
|
345
|
+
# Ensure bash + pnpm are resolvable for @cloudflare/next-on-pages (shellac dependency)
|
|
346
|
+
$gitBashBin = "C:\Program Files\Git\bin"
|
|
347
|
+
$pnpmBin1 = "C:\Program Files\nodejs"
|
|
348
|
+
$pnpmBin2 = "$env:LOCALAPPDATA\pnpm"
|
|
349
|
+
$originalPath = $env:PATH
|
|
350
|
+
$env:PATH = "$gitBashBin;$pnpmBin1;$pnpmBin2;$env:PATH"
|
|
351
|
+
Get-ChildItem -Path "out" -Recurse -Filter "__next*" -File | Remove-Item -Force -ErrorAction SilentlyContinue; Invoke-ModernCommand "Frontend Pages Upload" { pnpm run deploy }
|
|
352
|
+
$env:PATH = $originalPath
|
|
353
|
+
} finally {
|
|
354
|
+
Pop-Location
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
Write-Host "[SKIP] Frontend Deployment skipped." -ForegroundColor Gray
|
|
358
|
+
Add-Step "Frontend Deployment" "SKIPPED"
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
# Phase 3.5: Edge Verification
|
|
362
|
+
if (!$SkipFrontend -and !$SkipRouter) {
|
|
363
|
+
try {
|
|
364
|
+
Push-Location frontend
|
|
365
|
+
|
|
366
|
+
# PROACTIVE PLAYWRIGHT RESILIENCE: Kill zombies and remove locks
|
|
367
|
+
Write-Host "[RESILIENCE] Preparing clean state for Playwright..." -ForegroundColor Yellow
|
|
368
|
+
$pwProcs = Get-WmiObject Win32_Process | Where-Object {
|
|
369
|
+
$_.Name -match 'node.exe' -and
|
|
370
|
+
($_.CommandLine -match 'playwright' -or $_.CommandLine -match 'next dev')
|
|
371
|
+
}
|
|
372
|
+
foreach ($p in $pwProcs) {
|
|
373
|
+
Stop-Process -Id $p.ProcessId -Force -ErrorAction SilentlyContinue
|
|
374
|
+
}
|
|
375
|
+
$lockFile = Join-Path (Get-Location) ".next\lock"
|
|
376
|
+
if (Test-Path $lockFile) {
|
|
377
|
+
Remove-Item -Force $lockFile -ErrorAction SilentlyContinue
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
Invoke-ModernCommand "Edge Route Verification (Playwright)" { npx playwright test e2e/edge-router.spec.ts }
|
|
381
|
+
} catch {
|
|
382
|
+
Write-Host "[WARN] Edge Route Verification failed! Please check Cloudflare Worker logs." -ForegroundColor Red
|
|
383
|
+
throw $_
|
|
384
|
+
} finally {
|
|
385
|
+
Pop-Location
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
Write-Host "[SKIP] Edge Route Verification skipped (requires Frontend and Router sync)." -ForegroundColor Gray
|
|
389
|
+
Add-Step "Edge Route Verification" "SKIPPED"
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
# Phase 4: Mobile App Release
|
|
393
|
+
if (!$SkipApp) {
|
|
394
|
+
Invoke-ModernCommand "Mobile App Release" { & "$PSScriptRoot\scripts\release-mobile.ps1" }
|
|
395
|
+
} else {
|
|
396
|
+
Write-Host "[SKIP] Mobile App Release skipped." -ForegroundColor Gray
|
|
397
|
+
Add-Step "Mobile App Release" "SKIPPED"
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
# Phase 5: Finalize
|
|
401
|
+
$finalReport = Generate-FinalReport "SUCCESS"
|
|
402
|
+
Write-Host ""
|
|
403
|
+
Write-Host "DEPLOYMENT SUCCESSFUL!" -ForegroundColor Green
|
|
404
|
+
|
|
405
|
+
# Telegram Deployment Notification
|
|
406
|
+
Send-Notification -Status "SUCCESS" -Report $finalReport
|
|
407
|
+
|
|
408
|
+
# Antigravity Chat Notification
|
|
409
|
+
Send-AntigravityChat -Status "SUCCESS" -Report $finalReport
|
|
410
|
+
|
|
411
|
+
Write-Host $finalReport
|
|
412
|
+
Write-Host "[CLIPBOARD] Full report copied to your clipboard!" -ForegroundColor Cyan
|
|
413
|
+
Write-Host ""
|
|
414
|
+
Write-Host ">>> Deployment localized and verified." -ForegroundColor Cyan
|
package/deploy.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
TARGET=$(readlink -f ~/mediqueue_linux/mediqueue/frontend/node_modules/@cloudflare/next-on-pages/dist/index.js)
|
|
2
|
+
sed -i 's/await (0, import_esbuild.build)({/await (0, import_esbuild.build)({ logLevel: "error",/g' $TARGET
|
|
3
|
+
sed -i 's/await (0, import_esbuild2.build)({/await (0, import_esbuild2.build)({ logLevel: "error",/g' $TARGET
|
|
4
|
+
cd ~/mediqueue_linux/mediqueue/frontend
|
|
5
|
+
export NODE_OPTIONS="--max_old_space_size=16384"
|
|
6
|
+
npx @cloudflare/next-on-pages
|
|
7
|
+
cp -r .vercel /mnt/c/Users/shivg/Desktop/Hara-XY/mediqueue-main/mediqueue/frontend/
|
|
8
|
+
cd /mnt/c/Users/shivg/Desktop/Hara-XY/mediqueue-main/mediqueue/frontend
|
|
9
|
+
$env:WRANGLER_SEND_METRICS="false"
|
|
10
|
+
npx wrangler pages deploy .vercel/output/static
|