@daiyam/artifact-npm-cli-ts 0.5.1 → 0.6.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 +3 -8
- package/configs/src/cli.ts +1 -1
- package/configs/src/commands/hello.ts +1 -2
- package/configs/src/run.ts +3 -6
- package/package.json +2 -2
- package/configs/patches/enquirer+2.4.1.patch +0 -76
- package/configs/src/utils/confirm.ts +0 -12
- package/configs/src/utils/logger.ts +0 -56
package/configs/package.json
CHANGED
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
"#[[package.json.name]]": "bin/#[[package.json.name]]"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"prepack": "npm run
|
|
10
|
+
"build": "npm run clean && npm run compile:src",
|
|
11
|
+
"prepack": "npm run build"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"
|
|
15
|
-
"cli-spinners": "^3.4.0",
|
|
16
|
-
"commander": "^14.0.3",
|
|
17
|
-
"enquirer": "^2.4.1",
|
|
14
|
+
"@zokugun/cli-utils": "^0.1.0",
|
|
18
15
|
"execa": "^9.6.1",
|
|
19
|
-
"log-update": "^7.1.0",
|
|
20
|
-
"patch-package": "^8.0.1",
|
|
21
16
|
"trash": "^10.1.0"
|
|
22
17
|
}
|
|
23
18
|
}
|
package/configs/src/cli.ts
CHANGED
package/configs/src/run.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
import logger from '@zokugun/cli-utils/logger';
|
|
1
2
|
import { type CliOptions } from './types.js';
|
|
2
|
-
import * as logger from './utils/logger.js';
|
|
3
3
|
|
|
4
4
|
export async function run(options: CliOptions): Promise<void> {
|
|
5
|
-
|
|
5
|
+
logger.begin();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const duration = Math.ceil((Date.now() - start) / 1000);
|
|
9
|
-
|
|
10
|
-
logger.finish(duration);
|
|
7
|
+
logger.finish();
|
|
11
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daiyam/artifact-npm-cli-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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": "940d86c8d71671da59720c6c491dc7a0eb30ee6b"
|
|
35
35
|
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
diff --git a/node_modules/enquirer/index.d.ts b/node_modules/enquirer/index.d.ts
|
|
2
|
-
index 8150fa4..032eedf 100644
|
|
3
|
-
--- a/node_modules/enquirer/index.d.ts
|
|
4
|
-
+++ b/node_modules/enquirer/index.d.ts
|
|
5
|
-
@@ -1,6 +1,6 @@
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
|
-
|
|
8
|
-
-interface BasePromptOptions {
|
|
9
|
-
+export interface BasePromptOptions {
|
|
10
|
-
name: string | (() => string)
|
|
11
|
-
type: string | (() => string)
|
|
12
|
-
message: string | (() => string) | (() => Promise<string>)
|
|
13
|
-
@@ -19,7 +19,7 @@ interface BasePromptOptions {
|
|
14
|
-
stdout?: NodeJS.WriteStream
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
-interface Choice {
|
|
18
|
-
+export interface Choice {
|
|
19
|
-
name: string
|
|
20
|
-
message?: string
|
|
21
|
-
value?: unknown
|
|
22
|
-
@@ -29,7 +29,7 @@ interface Choice {
|
|
23
|
-
disabled?: boolean | string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
-interface ArrayPromptOptions extends BasePromptOptions {
|
|
27
|
-
+export interface ArrayPromptOptions extends BasePromptOptions {
|
|
28
|
-
type:
|
|
29
|
-
| 'autocomplete'
|
|
30
|
-
| 'editable'
|
|
31
|
-
@@ -52,18 +52,18 @@ interface ArrayPromptOptions extends BasePromptOptions {
|
|
32
|
-
scroll?: boolean
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
-interface BooleanPromptOptions extends BasePromptOptions {
|
|
36
|
-
+export interface BooleanPromptOptions extends BasePromptOptions {
|
|
37
|
-
type: 'confirm'
|
|
38
|
-
initial?: boolean
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
-interface StringPromptOptions extends BasePromptOptions {
|
|
42
|
-
+export interface StringPromptOptions extends BasePromptOptions {
|
|
43
|
-
type: 'input' | 'invisible' | 'list' | 'password' | 'text'
|
|
44
|
-
initial?: string
|
|
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
|
|
53
|
-
@@ -75,20 +75,20 @@ interface NumberPromptOptions extends BasePromptOptions {
|
|
54
|
-
initial?: number
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
-interface SnippetPromptOptions extends BasePromptOptions {
|
|
58
|
-
+export interface SnippetPromptOptions extends BasePromptOptions {
|
|
59
|
-
type: 'snippet'
|
|
60
|
-
newline?: string
|
|
61
|
-
template?: string
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
-interface SortPromptOptions extends BasePromptOptions {
|
|
65
|
-
+export interface SortPromptOptions extends BasePromptOptions {
|
|
66
|
-
type: 'sort'
|
|
67
|
-
hint?: string
|
|
68
|
-
drag?: boolean
|
|
69
|
-
numbered?: boolean
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
-type PromptOptions =
|
|
73
|
-
+export type PromptOptions =
|
|
74
|
-
| BasePromptOptions
|
|
75
|
-
| ArrayPromptOptions
|
|
76
|
-
| BooleanPromptOptions
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import c from 'ansi-colors';
|
|
2
|
-
import { type BooleanPromptOptions } from 'enquirer';
|
|
3
|
-
|
|
4
|
-
export function confirm(data: { name: string; message: string }): BooleanPromptOptions {
|
|
5
|
-
return {
|
|
6
|
-
type: 'confirm',
|
|
7
|
-
format(value) {
|
|
8
|
-
return value ? c.cyan('Yes') : c.cyan('No');
|
|
9
|
-
},
|
|
10
|
-
...data,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import c from 'ansi-colors';
|
|
2
|
-
import cliSpinners from 'cli-spinners';
|
|
3
|
-
import logUpdate from 'log-update';
|
|
4
|
-
|
|
5
|
-
export type IndicatorLoading = ReturnType<typeof setInterval>;
|
|
6
|
-
const { dots } = cliSpinners;
|
|
7
|
-
|
|
8
|
-
let $loading: IndicatorLoading | undefined;
|
|
9
|
-
|
|
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 {
|
|
15
|
-
clearInterval($loading);
|
|
16
|
-
|
|
17
|
-
logUpdate(`${c.red(c.symbols.cross)} ${c.bold('Error!')}`);
|
|
18
|
-
|
|
19
|
-
console.log(message);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function finish(duration: number): void {
|
|
23
|
-
clearInterval($loading);
|
|
24
|
-
|
|
25
|
-
logUpdate(`🏁 ${c.bold('Done')} (in ${duration}s).`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function log(message: string): void {
|
|
29
|
-
logUpdate.persist(`${c.cyan(c.symbols.bullet)} ${message}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function newLine(): void {
|
|
33
|
-
logUpdate.persist('');
|
|
34
|
-
}
|
|
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
|
-
|
|
54
|
-
export function warn(message: string): void {
|
|
55
|
-
logUpdate.persist(`${c.magenta(c.symbols.warning)} ${message}`);
|
|
56
|
-
}
|