@daiyam/artifact-npm-cli-ts 0.4.0 → 0.5.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/configs/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
diff --git a/node_modules/enquirer/index.d.ts b/node_modules/enquirer/index.d.ts
|
|
2
|
-
index 8150fa4..
|
|
2
|
+
index 8150fa4..032eedf 100644
|
|
3
3
|
--- a/node_modules/enquirer/index.d.ts
|
|
4
4
|
+++ b/node_modules/enquirer/index.d.ts
|
|
5
5
|
@@ -1,6 +1,6 @@
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
-interface BasePromptOptions {
|
|
9
9
|
+export interface BasePromptOptions {
|
|
10
10
|
name: string | (() => string)
|
|
@@ -13,7 +13,7 @@ index 8150fa4..1baad79 100644
|
|
|
13
13
|
@@ -19,7 +19,7 @@ interface BasePromptOptions {
|
|
14
14
|
stdout?: NodeJS.WriteStream
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
-interface Choice {
|
|
18
18
|
+export interface Choice {
|
|
19
19
|
name: string
|
|
@@ -22,38 +22,45 @@ index 8150fa4..1baad79 100644
|
|
|
22
22
|
@@ -29,7 +29,7 @@ interface Choice {
|
|
23
23
|
disabled?: boolean | string
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
-interface ArrayPromptOptions extends BasePromptOptions {
|
|
27
27
|
+export interface ArrayPromptOptions extends BasePromptOptions {
|
|
28
28
|
type:
|
|
29
29
|
| 'autocomplete'
|
|
30
30
|
| 'editable'
|
|
31
|
-
@@ -52,
|
|
31
|
+
@@ -52,18 +52,18 @@ interface ArrayPromptOptions extends BasePromptOptions {
|
|
32
32
|
scroll?: boolean
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
-interface BooleanPromptOptions extends BasePromptOptions {
|
|
36
36
|
+export interface BooleanPromptOptions extends BasePromptOptions {
|
|
37
37
|
type: 'confirm'
|
|
38
38
|
initial?: boolean
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
-interface StringPromptOptions extends BasePromptOptions {
|
|
42
42
|
+export interface StringPromptOptions extends BasePromptOptions {
|
|
43
43
|
type: 'input' | 'invisible' | 'list' | 'password' | 'text'
|
|
44
44
|
initial?: string
|
|
45
45
|
multiline?: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
-interface NumberPromptOptions extends BasePromptOptions {
|
|
49
|
+
+export interface NumberPromptOptions extends BasePromptOptions {
|
|
50
|
+
type: 'numeral'
|
|
51
|
+
min?: number
|
|
52
|
+
max?: number
|
|
46
53
|
@@ -75,20 +75,20 @@ interface NumberPromptOptions extends BasePromptOptions {
|
|
47
54
|
initial?: number
|
|
48
55
|
}
|
|
49
|
-
|
|
56
|
+
|
|
50
57
|
-interface SnippetPromptOptions extends BasePromptOptions {
|
|
51
58
|
+export interface SnippetPromptOptions extends BasePromptOptions {
|
|
52
59
|
type: 'snippet'
|
|
53
60
|
newline?: string
|
|
54
61
|
template?: string
|
|
55
62
|
}
|
|
56
|
-
|
|
63
|
+
|
|
57
64
|
-interface SortPromptOptions extends BasePromptOptions {
|
|
58
65
|
+export interface SortPromptOptions extends BasePromptOptions {
|
|
59
66
|
type: 'sort'
|
|
@@ -61,7 +68,7 @@ index 8150fa4..1baad79 100644
|
|
|
61
68
|
drag?: boolean
|
|
62
69
|
numbered?: boolean
|
|
63
70
|
}
|
|
64
|
-
|
|
71
|
+
|
|
65
72
|
-type PromptOptions =
|
|
66
73
|
+export type PromptOptions =
|
|
67
74
|
| BasePromptOptions
|
package/configs/src/run.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type CliOptions } from './types.js';
|
|
2
|
+
import * as logger from './utils/logger.js';
|
|
2
3
|
|
|
3
4
|
export async function run(options: CliOptions): Promise<void> {
|
|
5
|
+
const start = Date.now();
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const duration = Math.ceil((Date.now() - start) / 1000);
|
|
9
|
+
|
|
10
|
+
logger.finish(duration);
|
|
4
11
|
}
|
|
@@ -7,14 +7,16 @@ const { dots } = cliSpinners;
|
|
|
7
7
|
|
|
8
8
|
let $loading: IndicatorLoading | undefined;
|
|
9
9
|
|
|
10
|
-
export function
|
|
10
|
+
export function check(message: string): void {
|
|
11
|
+
logUpdate.persist(`${c.green(c.symbols.check)} ${message}`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function error(message: string): void {
|
|
11
15
|
clearInterval($loading);
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
logUpdate(`${c.red(c.symbols.cross)} ${c.bold('Error!')}`);
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
logUpdate(`${c.cyan(dots.frames[index = ++index % dots.frames.length])} ${label}`);
|
|
17
|
-
}, cliSpinners.dots.interval);
|
|
19
|
+
console.log(message);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export function finish(duration: number): void {
|
|
@@ -23,14 +25,6 @@ export function finish(duration: number): void {
|
|
|
23
25
|
logUpdate(`🏁 ${c.bold('Done')} (in ${duration}s).`);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export function error(message: string): void {
|
|
27
|
-
clearInterval($loading);
|
|
28
|
-
|
|
29
|
-
logUpdate(`${c.red(c.symbols.cross)} ${c.bold('Error!')}`);
|
|
30
|
-
|
|
31
|
-
console.log(message);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
28
|
export function log(message: string): void {
|
|
35
29
|
logUpdate.persist(`${c.cyan(c.symbols.bullet)} ${message}`);
|
|
36
30
|
}
|
|
@@ -39,6 +33,24 @@ export function newLine(): void {
|
|
|
39
33
|
logUpdate.persist('');
|
|
40
34
|
}
|
|
41
35
|
|
|
36
|
+
export function progress(label: string): void {
|
|
37
|
+
clearInterval($loading);
|
|
38
|
+
|
|
39
|
+
let index = 0;
|
|
40
|
+
|
|
41
|
+
$loading = setInterval(() => {
|
|
42
|
+
logUpdate(`${c.cyan(dots.frames[index = ++index % dots.frames.length])} ${label}`);
|
|
43
|
+
}, cliSpinners.dots.interval);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function step(label: string): () => void {
|
|
47
|
+
progress(c.bold(label) + c.dim('...'));
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
check(c.bold(`${label}:`) + c.dim(' done'));
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
export function warn(message: string): void {
|
|
43
55
|
logUpdate.persist(`${c.magenta(c.symbols.warning)} ${message}`);
|
|
44
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daiyam/artifact-npm-cli-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The configuration to create a CLI",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Baptiste Augrain",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"project-template",
|
|
32
32
|
"scaffold"
|
|
33
33
|
],
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "23c10e38663fb3db36447d806495b23d74f7cc65"
|
|
35
35
|
}
|