inflight-cli 1.0.1 → 1.0.3
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/login.js +13 -1
- package/dist/commands/share.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import { createServer } from "http";
|
|
4
|
-
import { writeGlobalAuth } from "../lib/config.js";
|
|
4
|
+
import { readGlobalAuth, writeGlobalAuth } from "../lib/config.js";
|
|
5
5
|
import { apiGetMe } from "../lib/api.js";
|
|
6
6
|
const DEFAULT_API_URL = process.env.INFLIGHT_API_URL ?? "https://api.inflight.co";
|
|
7
7
|
const WEB_URL = process.env.INFLIGHT_WEB_URL ?? "https://inflight.co";
|
|
8
8
|
export async function loginCommand() {
|
|
9
9
|
p.intro(pc.bgBlue(pc.white(" inflight login ")));
|
|
10
|
+
const existingAuth = readGlobalAuth();
|
|
11
|
+
if (existingAuth) {
|
|
12
|
+
const spinner = p.spinner();
|
|
13
|
+
spinner.start("Checking existing session...");
|
|
14
|
+
const me = await apiGetMe(existingAuth.apiKey, existingAuth.apiUrl).catch(() => null);
|
|
15
|
+
if (me) {
|
|
16
|
+
spinner.stop(`Already logged in as ${pc.bold(me.name)}`);
|
|
17
|
+
p.outro(pc.green("✓ You're already logged in"));
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
spinner.stop("Session expired — re-authenticating...");
|
|
21
|
+
}
|
|
10
22
|
p.log.info("Opening browser to authenticate with Inflight...");
|
|
11
23
|
const apiKey = await browserAuth();
|
|
12
24
|
const apiUrl = DEFAULT_API_URL;
|
package/dist/commands/share.js
CHANGED
|
@@ -99,8 +99,8 @@ export async function shareCommand() {
|
|
|
99
99
|
process.exit(1);
|
|
100
100
|
});
|
|
101
101
|
p.note(result.inflightUrl, "Your Inflight version");
|
|
102
|
-
p.outro(pc.green("✓ Done") + " — opening
|
|
102
|
+
p.outro(pc.green("✓ Done") + " — opening staging URL...");
|
|
103
103
|
const { default: open } = await import("open");
|
|
104
|
-
await open(
|
|
104
|
+
await open(stagingUrl);
|
|
105
105
|
process.exit(0);
|
|
106
106
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { shareCommand } from "./commands/share.js";
|
|
|
5
5
|
const program = new Command();
|
|
6
6
|
program
|
|
7
7
|
.name("inflight")
|
|
8
|
-
.description("
|
|
8
|
+
.description("Get feedback directly on your staging URL")
|
|
9
9
|
.version("0.1.0");
|
|
10
10
|
program
|
|
11
11
|
.command("login")
|