inflight-cli 2.12.0 → 2.13.0
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/index.js +21 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
2
3
|
import { Command } from "commander";
|
|
3
4
|
import updateNotifier from "update-notifier";
|
|
5
|
+
import pc from "picocolors";
|
|
4
6
|
import { loginCommand } from "./commands/login.js";
|
|
5
7
|
import { shareCommand } from "./commands/share.js";
|
|
6
8
|
import { logoutCommand } from "./commands/logout.js";
|
|
@@ -11,7 +13,25 @@ import { registerNetlifyCommand } from "./commands/netlify.js";
|
|
|
11
13
|
import { setupCommand } from "./commands/setup.js";
|
|
12
14
|
import pkg from "../package.json" with { type: "json" };
|
|
13
15
|
const { version } = pkg;
|
|
14
|
-
updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 })
|
|
16
|
+
const notifier = updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 });
|
|
17
|
+
if (notifier.update && notifier.update.latest !== version) {
|
|
18
|
+
const latest = notifier.update.latest;
|
|
19
|
+
if (process.stdout.isTTY) {
|
|
20
|
+
console.log(pc.yellow(`\n Update available: v${version} → v${latest}`) +
|
|
21
|
+
pc.dim(`\n Auto-updating for next run…`) +
|
|
22
|
+
pc.dim(`\n If this persists, run: npm i -g inflight-cli@${latest}\n`));
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const child = spawn("npm", ["install", "-g", `inflight-cli@${latest}`], {
|
|
26
|
+
detached: true,
|
|
27
|
+
stdio: "ignore",
|
|
28
|
+
});
|
|
29
|
+
child.unref();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Silent fail — banner will show again next run
|
|
33
|
+
}
|
|
34
|
+
}
|
|
15
35
|
const program = new Command();
|
|
16
36
|
program
|
|
17
37
|
.name("inflight")
|