inflight-cli 2.0.8 → 2.0.9

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.
@@ -1,7 +1,7 @@
1
1
  import * as p from "@clack/prompts";
2
2
  import pc from "picocolors";
3
3
  import { execSync } from "child_process";
4
- import { readGlobalAuth, writeWorkspaceConfig } from "../lib/config.js";
4
+ import { readGlobalAuth, readWorkspaceConfig, writeWorkspaceConfig } from "../lib/config.js";
5
5
  import { apiGetMe, apiDetectWidgetLocation } from "../lib/api.js";
6
6
  import { loginCommand } from "./login.js";
7
7
  import { shareCommand } from "./share.js";
@@ -36,7 +36,14 @@ export async function setupCommand() {
36
36
  });
37
37
  const workspaces = me.workspaces;
38
38
  let workspaceId;
39
- if (workspaces.length === 0) {
39
+ // Check if a workspace is already configured and still valid
40
+ const existingConfig = readWorkspaceConfig();
41
+ const existingWorkspace = existingConfig ? workspaces.find((w) => w.id === existingConfig.workspaceId) : null;
42
+ if (existingWorkspace) {
43
+ workspaceId = existingWorkspace.id;
44
+ p.log.success(`Workspace: ${pc.bold(existingWorkspace.name)} ${pc.dim("(change anytime with inflight workspaces)")}`);
45
+ }
46
+ else if (workspaces.length === 0) {
40
47
  p.log.error("No workspaces found. Create one at " + pc.cyan("inflight.co") + " first.");
41
48
  process.exit(1);
42
49
  }
@@ -46,7 +53,7 @@ export async function setupCommand() {
46
53
  }
47
54
  else {
48
55
  const selected = await p.select({
49
- message: "Select a workspace " + pc.dim("(change anytime with inflight workspace)"),
56
+ message: "Select a workspace " + pc.dim("(change anytime with inflight workspaces)"),
50
57
  options: workspaces.map((w) => ({ value: w.id, label: w.name })),
51
58
  });
52
59
  if (p.isCancel(selected)) {
@@ -66,7 +66,7 @@ export async function shareCommand(opts = {}) {
66
66
  }
67
67
  else {
68
68
  const selected = await p.select({
69
- message: "Select a workspace " + pc.dim("(change anytime with inflight workspace)"),
69
+ message: "Select a workspace " + pc.dim("(change anytime with inflight workspaces)"),
70
70
  options: me.workspaces.map((w) => ({ value: w.id, label: w.name })),
71
71
  });
72
72
  if (p.isCancel(selected)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inflight-cli",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Get feedback directly on your staging URL",
5
5
  "bin": {
6
6
  "inflight": "dist/index.js",