hermium 0.1.4 → 0.1.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/bin/hermium.mjs +38 -3
- package/dist/server/index.mjs +42 -42
- package/dist/web-server/index.mjs +80 -80
- package/package.json +1 -1
- /package/dist/{web → public}/assets/IconAlertCircle-B7TgWpbP.js +0 -0
- /package/dist/{web → public}/assets/IconAlertTriangle-B7IYa46Q.js +0 -0
- /package/dist/{web → public}/assets/IconCheck-B-_pWgtP.js +0 -0
- /package/dist/{web → public}/assets/IconCode-AzDguzgN.js +0 -0
- /package/dist/{web → public}/assets/IconLoader2-ClSf33Yd.js +0 -0
- /package/dist/{web → public}/assets/IconPlus-BcEAWT5L.js +0 -0
- /package/dist/{web → public}/assets/IconRefresh-D4MZeezY.js +0 -0
- /package/dist/{web → public}/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- /package/dist/{web → public}/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- /package/dist/{web → public}/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- /package/dist/{web → public}/assets/index-B-EALIKE.js +0 -0
- /package/dist/{web → public}/assets/index-BP5217kc.js +0 -0
- /package/dist/{web → public}/assets/index-BiFHsDt6.js +0 -0
- /package/dist/{web → public}/assets/index-BuznEPrX.js +0 -0
- /package/dist/{web → public}/assets/index-CsJLc3b2.js +0 -0
- /package/dist/{web → public}/assets/index-D04H-m2p.js +0 -0
- /package/dist/{web → public}/assets/index-DEVyhUPW.js +0 -0
- /package/dist/{web → public}/assets/index-DKYPj90W.js +0 -0
- /package/dist/{web → public}/assets/index-D_8SzN4W.js +0 -0
- /package/dist/{web → public}/assets/index-DmUrSr_K.js +0 -0
- /package/dist/{web → public}/assets/index-xH6PhxmS.js +0 -0
- /package/dist/{web → public}/assets/input-of658hyw.js +0 -0
- /package/dist/{web → public}/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- /package/dist/{web → public}/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- /package/dist/{web → public}/assets/styles-C9Ypt703.css +0 -0
- /package/dist/{web → public}/assets/switch-CgWk9YD3.js +0 -0
- /package/dist/{web → public}/assets/syntax-highlighter-CR5pD3DZ.js +0 -0
- /package/dist/{web → public}/assets/textarea-xdRt6_lX.js +0 -0
- /package/dist/{web → public}/assets/useQuery-BtGwEPDz.js +0 -0
- /package/dist/{web → public}/favicon.ico +0 -0
- /package/dist/{web → public}/favicon.png +0 -0
- /package/dist/{web → public}/manifest.json +0 -0
- /package/dist/{web → public}/nous-logo.png +0 -0
- /package/dist/{web → public}/robots.txt +0 -0
package/bin/hermium.mjs
CHANGED
|
@@ -6,8 +6,11 @@ import { readFileSync, writeFileSync, unlinkSync, mkdirSync, openSync, existsSyn
|
|
|
6
6
|
import { homedir } from 'os'
|
|
7
7
|
import pc from 'picocolors'
|
|
8
8
|
|
|
9
|
+
const pkgDir = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
10
|
+
const pkg = JSON.parse(readFileSync(resolve(pkgDir, 'package.json'), 'utf-8'))
|
|
11
|
+
const CURRENT_VERSION = pkg.version
|
|
12
|
+
|
|
9
13
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
10
|
-
const pkgDir = resolve(__dirname, '..')
|
|
11
14
|
const apiEntry = resolve(pkgDir, 'dist', 'server', 'index.mjs')
|
|
12
15
|
const webEntry = resolve(pkgDir, 'dist', 'web-server', 'index.mjs')
|
|
13
16
|
const webServerDir = resolve(pkgDir, 'dist', 'web-server')
|
|
@@ -17,7 +20,7 @@ const WEB_PID_FILE = join(WEB_UI_HOME, 'web.pid')
|
|
|
17
20
|
const API_LOG_FILE = join(WEB_UI_HOME, 'api.log')
|
|
18
21
|
const WEB_LOG_FILE = join(WEB_UI_HOME, 'web.log')
|
|
19
22
|
const DEFAULT_API_PORT = 8788
|
|
20
|
-
const DEFAULT_WEB_PORT =
|
|
23
|
+
const DEFAULT_WEB_PORT = 4242
|
|
21
24
|
|
|
22
25
|
// ─── Runtime detection ─────────────────────────────────────────────────────
|
|
23
26
|
|
|
@@ -38,6 +41,37 @@ function getRuntimeCmd() {
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
// ─── Version check ─────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
async function checkLatestVersion() {
|
|
47
|
+
const cacheFile = join(WEB_UI_HOME, '.version-check')
|
|
48
|
+
const now = Date.now()
|
|
49
|
+
try {
|
|
50
|
+
const cache = JSON.parse(readFileSync(cacheFile, 'utf-8'))
|
|
51
|
+
if (cache.ts && now - cache.ts < 60 * 60 * 1000) {
|
|
52
|
+
if (cache.latest && cache.latest !== CURRENT_VERSION) {
|
|
53
|
+
console.log(pc.yellow(` ⚠ A new version of Hermium is available: ${cache.latest} (you have ${CURRENT_VERSION})`))
|
|
54
|
+
console.log(` Upgrade: npm install -g hermium@latest`)
|
|
55
|
+
}
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const res = await fetch('https://registry.npmjs.org/hermium/latest', { signal: AbortSignal.timeout(3000) })
|
|
62
|
+
if (!res.ok) return
|
|
63
|
+
const data = await res.json()
|
|
64
|
+
const latest = data.version
|
|
65
|
+
writeFileSync(cacheFile, JSON.stringify({ ts: now, latest }))
|
|
66
|
+
if (latest && latest !== CURRENT_VERSION) {
|
|
67
|
+
console.log(pc.yellow(` ⚠ A new version of Hermium is available: ${latest} (you have ${CURRENT_VERSION})`))
|
|
68
|
+
console.log(` Upgrade: npm install -g hermium@latest`)
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
// silent fail — don't block startup for network issues
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
41
75
|
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
42
76
|
|
|
43
77
|
function readPid(file) {
|
|
@@ -209,7 +243,7 @@ async function cmdStart() {
|
|
|
209
243
|
env: {
|
|
210
244
|
HERMIUM_PORT: String(apiPort),
|
|
211
245
|
HERMIUM_WEB_PORT: String(webPort),
|
|
212
|
-
WEB_STATIC_DIR: resolve(pkgDir, 'dist', '
|
|
246
|
+
WEB_STATIC_DIR: resolve(pkgDir, 'dist', 'public'),
|
|
213
247
|
},
|
|
214
248
|
})
|
|
215
249
|
|
|
@@ -262,6 +296,7 @@ async function cmdStart() {
|
|
|
262
296
|
console.log(pc.green(` ✓ Hermium started`))
|
|
263
297
|
console.log(` ${webUrl}`)
|
|
264
298
|
console.log(` Logs: ${WEB_UI_HOME}`)
|
|
299
|
+
checkLatestVersion() // non-blocking
|
|
265
300
|
const openCmd =
|
|
266
301
|
process.platform === 'win32' ? `start ${webUrl}` :
|
|
267
302
|
process.platform === 'darwin' ? `open ${webUrl}` :
|