inflight-cli 2.11.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/commands/setup.js +2 -2
- package/dist/commands/share.js +12 -5
- package/dist/index.js +21 -1
- package/dist/lib/api.d.ts +1 -0
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -76,12 +76,12 @@ export async function setupCommand(opts = {}) {
|
|
|
76
76
|
const alreadyHasWidget = Object.values(context.fileContents).some((c) => c.includes("inflight.co/widget.js"));
|
|
77
77
|
const scriptTag = `<script src="https://www.inflight.co/widget.js" data-workspace="${widgetId}" async></script>`;
|
|
78
78
|
const nextSteps = alreadyHasWidget
|
|
79
|
-
? ["Widget already installed.
|
|
79
|
+
? ["Widget already installed. Now run `inflight share` (no arguments) to share the staging URL."]
|
|
80
80
|
: [
|
|
81
81
|
"Insert the scriptTag into the project's root layout file, just before </body> (or as the last child of <body> in JSX/TSX files).",
|
|
82
82
|
"Common locations: app/layout.tsx (Next.js), index.html (Vite/CRA), app/root.tsx (Remix), src/app.html (SvelteKit).",
|
|
83
83
|
"Commit and push the change so it's included in the next deployment.",
|
|
84
|
-
"Then run `inflight share` to share the staging URL
|
|
84
|
+
"Then run `inflight share` (no arguments) to share the staging URL.",
|
|
85
85
|
];
|
|
86
86
|
agentSuccess({
|
|
87
87
|
workspaceId,
|
package/dist/commands/share.js
CHANGED
|
@@ -36,6 +36,13 @@ function isValidHostedUrl(url) {
|
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
function appendWidgetToken(url, widgetToken) {
|
|
40
|
+
if (!widgetToken)
|
|
41
|
+
return url;
|
|
42
|
+
const parsed = new URL(url.startsWith("http") ? url : `https://${url}`);
|
|
43
|
+
parsed.searchParams.set("inflight_auth", widgetToken);
|
|
44
|
+
return parsed.toString();
|
|
45
|
+
}
|
|
39
46
|
/**
|
|
40
47
|
* Builds a next_command string carrying forward relevant opts from the current run. test
|
|
41
48
|
*/
|
|
@@ -420,7 +427,7 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
|
|
|
420
427
|
}).catch((e) => {
|
|
421
428
|
agentError({ type: "create_failed", message: e.message });
|
|
422
429
|
});
|
|
423
|
-
await open(resolvedUrl);
|
|
430
|
+
await open(appendWidgetToken(resolvedUrl, result.widgetToken));
|
|
424
431
|
agentSuccess({
|
|
425
432
|
stagingUrl: resolvedUrl,
|
|
426
433
|
...result,
|
|
@@ -503,7 +510,7 @@ export async function shareCommand(opts = {}) {
|
|
|
503
510
|
process.exit(1);
|
|
504
511
|
});
|
|
505
512
|
if (isAgent) {
|
|
506
|
-
await open(stagingUrl);
|
|
513
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
507
514
|
agentSuccess({ stagingUrl, ...result });
|
|
508
515
|
}
|
|
509
516
|
if (opts.json) {
|
|
@@ -513,7 +520,7 @@ export async function shareCommand(opts = {}) {
|
|
|
513
520
|
p.log.info(`Staging URL: ${pc.cyan(stagingUrl)}`);
|
|
514
521
|
p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
|
|
515
522
|
}
|
|
516
|
-
await open(stagingUrl);
|
|
523
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
517
524
|
return;
|
|
518
525
|
}
|
|
519
526
|
// ── Agent mode: structured flow with action_required for every choice ──
|
|
@@ -637,7 +644,7 @@ export async function shareCommand(opts = {}) {
|
|
|
637
644
|
}
|
|
638
645
|
}
|
|
639
646
|
}
|
|
640
|
-
await apiCreateVersion({
|
|
647
|
+
const result = await apiCreateVersion({
|
|
641
648
|
apiKey: auth.apiKey,
|
|
642
649
|
workspaceId,
|
|
643
650
|
stagingUrl,
|
|
@@ -655,5 +662,5 @@ export async function shareCommand(opts = {}) {
|
|
|
655
662
|
else {
|
|
656
663
|
p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
|
|
657
664
|
}
|
|
658
|
-
await open(stagingUrl);
|
|
665
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
659
666
|
}
|
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")
|
package/dist/lib/api.d.ts
CHANGED