helixevo 0.2.16 → 0.2.17
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/dashboard/components/update-banner.tsx +33 -9
- package/dist/cli.js +15 -8
- package/package.json +1 -1
|
@@ -56,23 +56,47 @@ export function UpdateBanner({ currentVersion }: { currentVersion: string }) {
|
|
|
56
56
|
if (data.success) {
|
|
57
57
|
setState('success')
|
|
58
58
|
setNewVersion(data.version)
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
// Step 1: Tell server to restart (exits with code 75)
|
|
60
61
|
setTimeout(async () => {
|
|
61
62
|
try {
|
|
62
63
|
await fetch('/api/restart', { method: 'POST' })
|
|
63
64
|
} catch {}
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
// Step 2: Wait for old server to go DOWN (fetch should fail)
|
|
67
|
+
let serverDown = false
|
|
68
|
+
for (let i = 0; i < 20; i++) {
|
|
69
|
+
await new Promise(r => setTimeout(r, 1000))
|
|
70
|
+
try {
|
|
71
|
+
await fetch('/api/restart', { method: 'GET', signal: AbortSignal.timeout(1000) })
|
|
72
|
+
// Still up — keep waiting
|
|
73
|
+
} catch {
|
|
74
|
+
serverDown = true
|
|
75
|
+
break
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Step 3: Wait for new server to come UP
|
|
80
|
+
if (serverDown) {
|
|
81
|
+
await new Promise(r => setTimeout(r, 2000)) // give it time to start
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < 40; i++) {
|
|
84
|
+
await new Promise(r => setTimeout(r, 1500))
|
|
66
85
|
try {
|
|
67
|
-
const res = await fetch('
|
|
86
|
+
const res = await fetch('/?_t=' + Date.now(), {
|
|
87
|
+
cache: 'no-store',
|
|
88
|
+
signal: AbortSignal.timeout(2000),
|
|
89
|
+
})
|
|
68
90
|
if (res.ok) {
|
|
69
|
-
|
|
70
|
-
window.location.
|
|
91
|
+
// Step 4: Hard reload with cache busting
|
|
92
|
+
window.location.href = window.location.pathname + '?updated=' + Date.now()
|
|
93
|
+
return
|
|
71
94
|
}
|
|
72
95
|
} catch {}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Fallback: force reload anyway
|
|
99
|
+
window.location.href = window.location.pathname + '?updated=' + Date.now()
|
|
76
100
|
}, 1500)
|
|
77
101
|
} else {
|
|
78
102
|
setState('error')
|
package/dist/cli.js
CHANGED
|
@@ -12405,15 +12405,22 @@ function launchDashboard(dir, openBrowser) {
|
|
|
12405
12405
|
console.log(`
|
|
12406
12406
|
\uD83D\uDD04 Restarting dashboard after update...
|
|
12407
12407
|
`);
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12408
|
+
setTimeout(() => {
|
|
12409
|
+
const nextCache = join15(dir, ".next");
|
|
12410
|
+
if (existsSync10(nextCache)) {
|
|
12411
|
+
try {
|
|
12412
|
+
rmSync2(nextCache, { recursive: true });
|
|
12413
|
+
} catch {}
|
|
12414
|
+
}
|
|
12415
|
+
ensureSkillGraph();
|
|
12416
|
+
let updatedVersion = currentVersion;
|
|
12417
|
+
try {
|
|
12418
|
+
updatedVersion = execSync2("helixevo --version 2>/dev/null", { encoding: "utf-8" }).trim() || currentVersion;
|
|
12419
|
+
} catch {}
|
|
12420
|
+
console.log(` \uD83C\uDF10 HelixEvo Dashboard v${updatedVersion} at http://localhost:3847
|
|
12415
12421
|
`);
|
|
12416
|
-
|
|
12422
|
+
launchDashboard(dir, false);
|
|
12423
|
+
}, 2000);
|
|
12417
12424
|
} else {
|
|
12418
12425
|
process.exit(code ?? 0);
|
|
12419
12426
|
}
|
package/package.json
CHANGED