@respan/cli 0.3.1 → 0.3.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/auth/login.js +4 -3
- package/dist/lib/banner.d.ts +1 -1
- package/dist/lib/banner.js +7 -2
- package/oclif.manifest.json +426 -426
- package/package.json +5 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { select,
|
|
2
|
+
import { select, input } from '@inquirer/prompts';
|
|
3
3
|
import * as http from 'node:http';
|
|
4
4
|
import * as open from 'node:child_process';
|
|
5
5
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
6
6
|
import { setCredential, setActiveProfile } from '../../lib/config.js';
|
|
7
|
-
import { printLoginSuccess } from '../../lib/banner.js';
|
|
7
|
+
import { printBanner, printLoginSuccess } from '../../lib/banner.js';
|
|
8
8
|
import { DEFAULT_BASE_URL, ENTERPRISE_BASE_URL } from '../../lib/auth.js';
|
|
9
9
|
const CALLBACK_PORT = 18392;
|
|
10
10
|
const CALLBACK_PATH = '/callback';
|
|
@@ -93,6 +93,7 @@ class AuthLogin extends BaseCommand {
|
|
|
93
93
|
this.globalFlags = flags;
|
|
94
94
|
const profile = flags['profile-name'] || 'default';
|
|
95
95
|
setActiveProfile(profile);
|
|
96
|
+
await printBanner();
|
|
96
97
|
// Step 1: Determine environment (skip if --enterprise flag or --api-key with flag)
|
|
97
98
|
const enterprise = flags.enterprise || (!flags['api-key'] && await select({
|
|
98
99
|
message: 'Select your environment:',
|
|
@@ -117,7 +118,7 @@ class AuthLogin extends BaseCommand {
|
|
|
117
118
|
],
|
|
118
119
|
});
|
|
119
120
|
if (method === 'api_key') {
|
|
120
|
-
const apiKey = await
|
|
121
|
+
const apiKey = await input({ message: 'Enter your Respan API key:' });
|
|
121
122
|
setCredential(profile, { type: 'api_key', apiKey, baseUrl });
|
|
122
123
|
await printLoginSuccess(undefined, profile);
|
|
123
124
|
return;
|
package/dist/lib/banner.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function printBanner(): void
|
|
1
|
+
export declare function printBanner(): Promise<void>;
|
|
2
2
|
export declare function printLoginSuccess(email?: string, profile?: string): Promise<void>;
|
package/dist/lib/banner.js
CHANGED
|
@@ -90,12 +90,17 @@ function renderBanner(lines) {
|
|
|
90
90
|
return result;
|
|
91
91
|
}
|
|
92
92
|
const PC = '\x1b[38;2;100;131;240m'; // primary color
|
|
93
|
-
|
|
93
|
+
function sleep(ms) {
|
|
94
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
95
|
+
}
|
|
96
|
+
export async function printBanner() {
|
|
94
97
|
if (!process.stdout.isTTY || process.env.NO_COLOR)
|
|
95
98
|
return;
|
|
99
|
+
const lines = renderBanner(BANNER_LINES);
|
|
96
100
|
console.log('');
|
|
97
|
-
for (const line of
|
|
101
|
+
for (const line of lines) {
|
|
98
102
|
console.log(line);
|
|
103
|
+
await sleep(80);
|
|
99
104
|
}
|
|
100
105
|
console.log('');
|
|
101
106
|
}
|