heyio 0.1.4 → 0.1.5
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/dist/daemon.js +2 -9
- package/dist/update.js +4 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -44,17 +44,10 @@ function pruneOldSessions() {
|
|
|
44
44
|
}
|
|
45
45
|
export async function startDaemon() {
|
|
46
46
|
console.log("[io] Starting IO daemon...");
|
|
47
|
-
// Auto-update on startup
|
|
47
|
+
// Auto-update on startup — exit after update; systemd will restart us
|
|
48
48
|
const updated = await autoUpdate();
|
|
49
49
|
if (updated) {
|
|
50
|
-
|
|
51
|
-
const { spawn } = await import("child_process");
|
|
52
|
-
const child = spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
53
|
-
detached: true,
|
|
54
|
-
stdio: "inherit",
|
|
55
|
-
env: { ...process.env, IO_RESTARTED: "1" },
|
|
56
|
-
});
|
|
57
|
-
child.unref();
|
|
50
|
+
console.log("[io] Exiting for systemd restart with updated version...");
|
|
58
51
|
process.exit(0);
|
|
59
52
|
}
|
|
60
53
|
if (config.selfEditEnabled) {
|
package/dist/update.js
CHANGED
|
@@ -5,10 +5,11 @@ import { dirname, join } from "path";
|
|
|
5
5
|
const PACKAGE_NAME = "heyio";
|
|
6
6
|
function getInstalledVersion() {
|
|
7
7
|
try {
|
|
8
|
-
// Ask npm what version is installed globally —
|
|
8
|
+
// Ask npm what version is installed globally — run from /tmp to avoid local package interference
|
|
9
9
|
const output = execSync(`npm list -g ${PACKAGE_NAME} --depth=0 --json 2>/dev/null`, {
|
|
10
10
|
encoding: "utf-8",
|
|
11
11
|
timeout: 10_000,
|
|
12
|
+
cwd: "/tmp",
|
|
12
13
|
});
|
|
13
14
|
const data = JSON.parse(output);
|
|
14
15
|
return data.dependencies?.[PACKAGE_NAME]?.version ?? "0.0.0";
|
|
@@ -32,6 +33,7 @@ export async function checkForUpdate() {
|
|
|
32
33
|
const latest = execSync(`npm view ${PACKAGE_NAME} version 2>/dev/null`, {
|
|
33
34
|
encoding: "utf-8",
|
|
34
35
|
timeout: 10_000,
|
|
36
|
+
cwd: "/tmp",
|
|
35
37
|
}).trim();
|
|
36
38
|
if (!latest)
|
|
37
39
|
return { updateAvailable: false, current, latest: current };
|
|
@@ -56,6 +58,7 @@ export async function autoUpdate() {
|
|
|
56
58
|
encoding: "utf-8",
|
|
57
59
|
timeout: 60_000,
|
|
58
60
|
stdio: "pipe",
|
|
61
|
+
cwd: "/tmp",
|
|
59
62
|
});
|
|
60
63
|
console.log(`[io] ✓ Updated to v${info.latest}. Restarting...`);
|
|
61
64
|
return true;
|