repowisestage 0.0.18 → 0.0.20
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/bin/repowise.js +13 -14
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -8,10 +8,8 @@ import { Command } from "commander";
|
|
|
8
8
|
|
|
9
9
|
// ../listener/dist/main.js
|
|
10
10
|
import { readFile as readFile5, writeFile as writeFile7, mkdir as mkdir7 } from "fs/promises";
|
|
11
|
-
import { execFile as execFile4 } from "child_process";
|
|
12
11
|
import { join as join12, dirname as dirname4 } from "path";
|
|
13
12
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14
|
-
import { promisify as promisify3 } from "util";
|
|
15
13
|
import lockfile2 from "proper-lockfile";
|
|
16
14
|
|
|
17
15
|
// ../../packages/shared/src/config-dir.ts
|
|
@@ -1248,7 +1246,6 @@ async function stopListener() {
|
|
|
1248
1246
|
}
|
|
1249
1247
|
|
|
1250
1248
|
// ../listener/dist/main.js
|
|
1251
|
-
var execFileAsync3 = promisify3(execFile4);
|
|
1252
1249
|
var TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1e3;
|
|
1253
1250
|
var STALE_CHECK_COOLDOWN_MS = 60 * 60 * 1e3;
|
|
1254
1251
|
var CRASH_LOOP_WINDOW_MS = 3e4;
|
|
@@ -1682,23 +1679,25 @@ async function startListener() {
|
|
|
1682
1679
|
if (Date.now() - lastAttempt >= backoffMs) {
|
|
1683
1680
|
const listenerStatus = await getListenerStatus();
|
|
1684
1681
|
state.lastUpdateAttemptAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1685
|
-
|
|
1686
|
-
|
|
1682
|
+
const updateResult = await installUpdate(currentVersion, packageName, latestCliVersion);
|
|
1683
|
+
if (updateResult.updated) {
|
|
1684
|
+
state.updateFailCount = 0;
|
|
1687
1685
|
await saveState(state);
|
|
1688
|
-
|
|
1689
|
-
const updateResult = await installUpdate(currentVersion, packageName, latestCliVersion);
|
|
1690
|
-
if (updateResult.updated) {
|
|
1691
|
-
state.updateFailCount = 0;
|
|
1692
|
-
await saveState(state);
|
|
1686
|
+
if (listenerStatus.serviceInstalled) {
|
|
1693
1687
|
console.log("[auto-update] Restarting with new version...");
|
|
1694
1688
|
await shutdown();
|
|
1695
1689
|
process.exit(0);
|
|
1696
|
-
} else if (updateResult.error) {
|
|
1697
|
-
state.updateFailCount = (state.updateFailCount ?? 0) + 1;
|
|
1698
|
-
await saveState(state);
|
|
1699
1690
|
} else {
|
|
1700
|
-
|
|
1691
|
+
console.log("[auto-update] Spawning new listener with updated version...");
|
|
1692
|
+
await shutdown();
|
|
1693
|
+
await startBackground();
|
|
1694
|
+
process.exit(0);
|
|
1701
1695
|
}
|
|
1696
|
+
} else if (updateResult.error) {
|
|
1697
|
+
state.updateFailCount = (state.updateFailCount ?? 0) + 1;
|
|
1698
|
+
await saveState(state);
|
|
1699
|
+
} else {
|
|
1700
|
+
await saveState(state);
|
|
1702
1701
|
}
|
|
1703
1702
|
}
|
|
1704
1703
|
}
|