@vendian/cli 0.0.26 → 0.0.27
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/cli-wrapper.mjs +37 -19
- package/package.json +1 -1
package/cli-wrapper.mjs
CHANGED
|
@@ -1107,7 +1107,7 @@ import path8 from "node:path";
|
|
|
1107
1107
|
import readlinePromises from "node:readline/promises";
|
|
1108
1108
|
|
|
1109
1109
|
// src/version.js
|
|
1110
|
-
var CLI_VERSION = true ? "0.0.
|
|
1110
|
+
var CLI_VERSION = true ? "0.0.27" : process.env.npm_package_version || "0.0.0-dev";
|
|
1111
1111
|
|
|
1112
1112
|
// src/npm-update.js
|
|
1113
1113
|
var NPM_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
|
|
@@ -2588,17 +2588,10 @@ async function showConnect({ env, platform }) {
|
|
|
2588
2588
|
}
|
|
2589
2589
|
const ep = ENDPOINTS[resp.selectedIndex];
|
|
2590
2590
|
term("\n");
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
await switchOrLoginEndpoint({ backend: ep.key, env, platform });
|
|
2595
|
-
term.green(` ${fig.check} Signed in to ${ep.label} successfully
|
|
2596
|
-
`);
|
|
2597
|
-
} catch (error) {
|
|
2598
|
-
term.red(` ${endpointErrorStatus(error)}
|
|
2599
|
-
`);
|
|
2591
|
+
const outcome = await connectEndpointInteractive({ backend: ep.key, label: ep.label, env, platform });
|
|
2592
|
+
if (outcome.promptedInTui) {
|
|
2593
|
+
await pressEnterToContinue();
|
|
2600
2594
|
}
|
|
2601
|
-
await pressEnterToContinue({ grabActive: false });
|
|
2602
2595
|
}
|
|
2603
2596
|
}
|
|
2604
2597
|
async function connectCustomUrl({ env, platform }) {
|
|
@@ -2611,15 +2604,10 @@ async function connectCustomUrl({ env, platform }) {
|
|
|
2611
2604
|
if (!url) return;
|
|
2612
2605
|
term("\n\n");
|
|
2613
2606
|
term.gray(" Connecting\u2026\n");
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
`);
|
|
2618
|
-
} catch (error) {
|
|
2619
|
-
term.red(` ${endpointErrorStatus(error)}
|
|
2620
|
-
`);
|
|
2607
|
+
const outcome = await connectEndpointInteractive({ apiUrl: url, label: url, env, platform, successLabel: "Connected successfully" });
|
|
2608
|
+
if (outcome.promptedInTui) {
|
|
2609
|
+
await pressEnterToContinue();
|
|
2621
2610
|
}
|
|
2622
|
-
await pressEnterToContinue({ grabActive: false });
|
|
2623
2611
|
}
|
|
2624
2612
|
async function showCreate({ env, platform }) {
|
|
2625
2613
|
term.clear();
|
|
@@ -3477,6 +3465,36 @@ async function switchOrLoginEndpoint({
|
|
|
3477
3465
|
await setupFn({ backend, apiUrl, forceAuth: true, env, platform });
|
|
3478
3466
|
return { apiUrl: status.apiUrl, reused: false, activated: true };
|
|
3479
3467
|
}
|
|
3468
|
+
async function connectEndpointInteractive({
|
|
3469
|
+
backend,
|
|
3470
|
+
apiUrl,
|
|
3471
|
+
label,
|
|
3472
|
+
env = process.env,
|
|
3473
|
+
platform = process.platform,
|
|
3474
|
+
setupFn = setup,
|
|
3475
|
+
activateFn = activateCloudProfile,
|
|
3476
|
+
successLabel
|
|
3477
|
+
} = {}) {
|
|
3478
|
+
const status = cloudAuthStatus({ backend, apiUrl, env, platform });
|
|
3479
|
+
const destination = label || envLabel(status.apiUrl);
|
|
3480
|
+
if (status.authenticated) {
|
|
3481
|
+
term.gray(` Connecting to ${destination}\u2026
|
|
3482
|
+
`);
|
|
3483
|
+
try {
|
|
3484
|
+
await switchOrLoginEndpoint({ backend, apiUrl, env, platform, setupFn, activateFn });
|
|
3485
|
+
term.green(` ${fig.check} ${successLabel || `Signed in to ${destination} successfully`}
|
|
3486
|
+
`);
|
|
3487
|
+
} catch (error) {
|
|
3488
|
+
term.red(` ${endpointErrorStatus(error)}
|
|
3489
|
+
`);
|
|
3490
|
+
}
|
|
3491
|
+
return { promptedInTui: true };
|
|
3492
|
+
}
|
|
3493
|
+
await withOutputMode(`Connecting to ${destination}`, async () => {
|
|
3494
|
+
await switchOrLoginEndpoint({ backend, apiUrl, env, platform, setupFn, activateFn });
|
|
3495
|
+
});
|
|
3496
|
+
return { promptedInTui: false };
|
|
3497
|
+
}
|
|
3480
3498
|
function endpointErrorStatus(error) {
|
|
3481
3499
|
const message = error && typeof error.message === "string" ? error.message : String(error || "Connection failed");
|
|
3482
3500
|
return `${fig.cross} ${message}`;
|