@stacksjs/cli 0.65.0 → 0.68.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/dist/app.d.ts +81 -89
- package/dist/cli.d.ts +12 -8
- package/dist/command.d.ts +33 -25
- package/dist/console.d.ts +15 -3
- package/dist/exec.d.ts +3 -38
- package/dist/helpers.d.ts +3 -8
- package/dist/index.d.ts +10 -10
- package/dist/index.js +21362 -12
- package/dist/install.d.ts +13 -0
- package/dist/parse.d.ts +11 -11
- package/dist/run.d.ts +3 -60
- package/dist/spinner.d.ts +1 -2
- package/dist/utils.d.ts +6 -5
- package/package.json +14 -14
- package/dist/actions/index.d.ts +0 -1
- package/dist/actions/install.d.ts +0 -26
- package/dist/index.js.map +0 -120
- package/src/actions/index.ts +0 -1
- package/src/actions/install.ts +0 -41
- package/src/app.ts +0 -777
- package/src/cli.ts +0 -30
- package/src/command.ts +0 -54
- package/src/console.ts +0 -4
- package/src/exec.ts +0 -140
- package/src/helpers.ts +0 -79
- package/src/index.ts +0 -10
- package/src/parse.ts +0 -182
- package/src/run.ts +0 -112
- package/src/spinner.ts +0 -3
- package/src/utils.ts +0 -83
package/dist/app.d.ts
CHANGED
|
@@ -1,100 +1,92 @@
|
|
|
1
|
-
export { isCancel } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { isCancel } from '@clack/core'
|
|
2
|
+
declare type State,
|
|
3
|
+
TextPrompt,
|
|
4
|
+
} from '@clack/core'
|
|
5
|
+
declare const unicode: (...args: any[]) => unknown;
|
|
6
|
+
declare const S_BAR_START: unknown;
|
|
7
|
+
declare const S_RADIO_ACTIVE: unknown;
|
|
8
|
+
declare const S_BAR_H: unknown;
|
|
9
|
+
declare function symbol(state: State): void;
|
|
10
|
+
declare interface LimitOptionsParams<TOption> {
|
|
11
|
+
options: TOption[]
|
|
12
|
+
maxItems: number | undefined
|
|
13
|
+
cursor: number
|
|
14
|
+
style: (option: TOption, active: boolean) => string
|
|
8
15
|
}
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
declare function limitOptions<TOption>(params: LimitOptionsParams<TOption>): string[];
|
|
17
|
+
export declare function text(opts: TextOptions): void;
|
|
18
|
+
export declare interface PasswordOptions {
|
|
19
|
+
message: string
|
|
20
|
+
mask?: string
|
|
21
|
+
validate?: (value: string) => string | void
|
|
14
22
|
}
|
|
15
|
-
export declare function password(opts: PasswordOptions):
|
|
16
|
-
export interface ConfirmOptions {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
export declare function password(opts: PasswordOptions): void;
|
|
24
|
+
export declare interface ConfirmOptions {
|
|
25
|
+
message: string
|
|
26
|
+
active?: string
|
|
27
|
+
inactive?: string
|
|
28
|
+
initialValue?: boolean
|
|
21
29
|
}
|
|
22
|
-
export declare function confirm(opts: ConfirmOptions):
|
|
23
|
-
type Primitive = Readonly<string | boolean | number
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
export interface SelectOptions<Value> {
|
|
34
|
-
message: string;
|
|
35
|
-
options: Option<Value>[];
|
|
36
|
-
initialValue?: Value;
|
|
37
|
-
maxItems?: number;
|
|
30
|
+
export declare function confirm(opts: ConfirmOptions): void;
|
|
31
|
+
declare type Primitive = Readonly<string | boolean | number>
|
|
32
|
+
|
|
33
|
+
type Option<Value> = Value extends Primitive
|
|
34
|
+
? { value: Value, label?: string, hint?: string }
|
|
35
|
+
export declare interface SelectOptions<Value> {
|
|
36
|
+
message: string
|
|
37
|
+
options: Option<Value>[]
|
|
38
|
+
initialValue?: Value
|
|
39
|
+
maxItems?: number
|
|
38
40
|
}
|
|
39
|
-
export declare function select<Value>(opts: SelectOptions<Value>):
|
|
40
|
-
export declare function selectKey<Value extends string>(opts: SelectOptions<Value>):
|
|
41
|
-
export interface MultiSelectOptions<Value> {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export declare function select<Value>(opts: SelectOptions<Value>): void;
|
|
42
|
+
export declare function selectKey<Value extends string>(opts: SelectOptions<Value>): void;
|
|
43
|
+
export declare interface MultiSelectOptions<Value> {
|
|
44
|
+
message: string
|
|
45
|
+
options: Option<Value>[]
|
|
46
|
+
initialValues?: Value[]
|
|
47
|
+
maxItems?: number
|
|
48
|
+
required?: boolean
|
|
49
|
+
cursorAt?: Value
|
|
48
50
|
}
|
|
49
|
-
export declare function multiselect<Value>(opts: MultiSelectOptions<Value>):
|
|
50
|
-
export interface GroupMultiSelectOptions<Value> {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
export declare function multiselect<Value>(opts: MultiSelectOptions<Value>): void;
|
|
52
|
+
export declare interface GroupMultiSelectOptions<Value> {
|
|
53
|
+
message: string
|
|
54
|
+
options: Record<string, Option<Value>[]>
|
|
55
|
+
initialValues?: Value[]
|
|
56
|
+
required?: boolean
|
|
57
|
+
cursorAt?: Value
|
|
56
58
|
}
|
|
57
|
-
export declare function groupMultiselect<Value>(opts: GroupMultiSelectOptions<Value>):
|
|
58
|
-
|
|
59
|
-
export declare function cancel(message
|
|
60
|
-
export declare function intro(title
|
|
61
|
-
export declare function outro(message
|
|
62
|
-
interface Spinner {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
export declare function groupMultiselect<Value>(opts: GroupMultiSelectOptions<Value>): void;
|
|
60
|
+
declare const strip: (str: string) => unknown;
|
|
61
|
+
export declare function cancel(message = ''): void;
|
|
62
|
+
export declare function intro(title = ''): void;
|
|
63
|
+
export declare function outro(message = ''): void;
|
|
64
|
+
declare interface Spinner {
|
|
65
|
+
start: (msg: string) => void
|
|
66
|
+
stop: (msg: string, code: number) => void
|
|
67
|
+
message: (msg: string) => void
|
|
66
68
|
}
|
|
67
69
|
export declare function spinner(): Spinner;
|
|
68
|
-
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
declare function ansiRegex(): void;
|
|
71
|
+
export declare type PromptGroupAwaitedReturn<T> = {
|
|
72
|
+
[P in keyof T]: Exclude<Awaited<T[P]>, symbol>
|
|
73
|
+
}
|
|
74
|
+
export declare interface PromptGroupOptions<T> {
|
|
75
|
+
onCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void
|
|
76
|
+
}
|
|
77
|
+
declare type Prettify<T> = {
|
|
78
|
+
[P in keyof T]: T[P]
|
|
79
|
+
} & {}
|
|
80
|
+
export declare type PromptGroup<T> = {
|
|
81
|
+
[P in keyof T]: (opts: {
|
|
82
|
+
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>
|
|
83
|
+
}) => void | Promise<T[P] | void>
|
|
75
84
|
}
|
|
76
|
-
type Prettify<T> = { [P in keyof T] : T[P] } & {};
|
|
77
|
-
export type PromptGroup<T> = { [P in keyof T] : (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>> }) => void | Promise<T[P] | void> };
|
|
78
|
-
/**
|
|
79
|
-
* Define a group of prompts to be displayed
|
|
80
|
-
* and return a results of objects within the group
|
|
81
|
-
*/
|
|
82
85
|
export declare function group<T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>): Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
|
|
83
|
-
export interface Task {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Task function
|
|
90
|
-
*/
|
|
91
|
-
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* If enabled === false the task will be skipped
|
|
94
|
-
*/
|
|
95
|
-
enabled?: boolean;
|
|
86
|
+
export declare interface Task {
|
|
87
|
+
title: string
|
|
88
|
+
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>
|
|
89
|
+
|
|
90
|
+
enabled?: boolean
|
|
96
91
|
}
|
|
97
|
-
|
|
98
|
-
* Define a group of tasks to be executed
|
|
99
|
-
*/
|
|
100
|
-
export declare function tasks(tasks: Task[]): Promise<void>;
|
|
92
|
+
export declare function tasks(tasks: Task[]): Promise<void>;
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { CliOptions } from '@stacksjs/types';
|
|
2
|
+
import { CAC } from 'cac';
|
|
3
|
+
|
|
4
|
+
export { CAC }
|
|
5
|
+
export declare interface ParsedArgv {
|
|
6
|
+
args: ReadonlyArray<string>
|
|
7
|
+
options: {
|
|
8
|
+
[k: string]: any
|
|
9
|
+
}
|
|
5
10
|
}
|
|
6
|
-
interface CliOptions {
|
|
7
|
-
|
|
11
|
+
declare interface CliOptions {
|
|
12
|
+
name?: string
|
|
8
13
|
}
|
|
9
|
-
export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
|
|
10
|
-
export { CAC };
|
|
14
|
+
export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
|
package/dist/command.d.ts
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type CommandOptionTuple = [string, string, { default: boolean }]
|
|
1
|
+
import type { CliOptions, Readable } from '@stacksjs/types';
|
|
2
|
+
|
|
3
|
+
declare type CommandOptionTuple = [string, string, { default: boolean }]
|
|
4
4
|
interface CommandOptionObject {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
name: string
|
|
6
|
+
description: string
|
|
7
|
+
default: boolean | string
|
|
8
8
|
}
|
|
9
|
-
type CommandOptions = CommandOptionTuple | CommandOptionObject[]
|
|
9
|
+
declare type CommandOptions = CommandOptionTuple | CommandOptionObject[]
|
|
10
10
|
interface Options {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
name: string
|
|
12
|
+
description: string
|
|
13
|
+
active: boolean
|
|
14
|
+
options: CommandOptions
|
|
15
|
+
run: (options?: CliOptions) => Promise<any>
|
|
16
|
+
onFail: (error: Error) => void
|
|
17
|
+
onSuccess: () => void
|
|
18
18
|
}
|
|
19
19
|
export declare class Command {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
name: Options['name']
|
|
21
|
+
description: Options['description']
|
|
22
|
+
options: Options['options']
|
|
23
|
+
run: Options['run']
|
|
24
|
+
onFail: Options['onFail']
|
|
25
|
+
onSuccess: Options['onSuccess']
|
|
26
|
+
|
|
27
|
+
constructor({ name, description, options, run, onFail, onSuccess }: Options) {
|
|
28
|
+
this.name = name
|
|
29
|
+
this.description = description
|
|
30
|
+
this.options = options
|
|
31
|
+
this.run = run
|
|
32
|
+
this.onFail = onFail
|
|
33
|
+
this.onSuccess = onSuccess
|
|
34
|
+
}
|
|
27
35
|
}
|
|
28
36
|
export declare const command: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
run: unknown;
|
|
38
|
+
Readable, Readable>, Error>> => {
|
|
39
|
+
return await runCommand: () => unknown
|
|
40
|
+
};
|
package/dist/console.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import { log } from
|
|
2
|
-
|
|
3
|
-
export { log, prompts }
|
|
1
|
+
import { log } from '@stacksjs/logging';
|
|
2
|
+
|
|
3
|
+
export { log, prompts }
|
|
4
|
+
|
|
5
|
+
export default function terminalLink(text: string, url: string, { target = 'stdout', ...options }: { target?: string, fallback?: boolean | Function }): string {
|
|
6
|
+
if (!supportsHyperlinks[target]) {
|
|
7
|
+
if (options.fallback === false) {
|
|
8
|
+
return text
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return ansiEscapes.link(text, url)
|
|
15
|
+
};
|
package/dist/exec.d.ts
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
import type { CliOptions, Subprocess } from
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Execute a command.
|
|
5
|
-
*
|
|
6
|
-
* @param command The command to execute.
|
|
7
|
-
* @param options The options to pass to the command.
|
|
8
|
-
* @returns The result of the command.
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const result = await exec('ls')
|
|
12
|
-
*
|
|
13
|
-
* if (result.isErr())
|
|
14
|
-
* console.error(result.error)
|
|
15
|
-
* else
|
|
16
|
-
* console.log(result)
|
|
17
|
-
* ```
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const result = await exec('ls', { cwd: '/home' })
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
1
|
+
import type { CliOptions, Subprocess } from '@stacksjs/types';
|
|
2
|
+
|
|
23
3
|
export declare function exec(command: string | string[], options?: CliOptions): Promise<Result<Subprocess, Error>>;
|
|
24
|
-
/**
|
|
25
|
-
* Execute a command and return result.
|
|
26
|
-
*
|
|
27
|
-
* @param command The command to execute.
|
|
28
|
-
* @returns The result of the command.
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* const output = execSync('ls')
|
|
32
|
-
*
|
|
33
|
-
* console.log(output)
|
|
34
|
-
* ```
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* const output = execSync('ls', { cwd: '/home' })
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
4
|
export declare function execSync(command: string | string[], options?: CliOptions): Promise<string>;
|
|
5
|
+
declare function exitHandler(type: 'spawn' | 'spawnSync', subprocess: Subprocess, exitCode: number | null, signalCode: number | null, error?: Error,): void;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type { IntroOptions, OutroOptions } from
|
|
2
|
-
|
|
3
|
-
* Prints the intro message.
|
|
4
|
-
*/
|
|
1
|
+
import type { IntroOptions, OutroOptions } from '@stacksjs/types';
|
|
2
|
+
|
|
5
3
|
export declare function intro(command: string, options?: IntroOptions): Promise<number>;
|
|
6
|
-
|
|
7
|
-
* Prints the outro message.
|
|
8
|
-
*/
|
|
9
|
-
export declare function outro(text: string, options?: OutroOptions, error?: Error | string): Promise<number>;
|
|
4
|
+
export declare function outro(text: string, options?: OutroOptions, error?: Error | string): Promise<number>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
1
|
+
export * from './actions'
|
|
2
|
+
export * from './cli'
|
|
3
|
+
export * from './command'
|
|
4
|
+
export * from './console'
|
|
5
|
+
export * from './exec'
|
|
6
|
+
export * from './helpers'
|
|
7
|
+
export * from './parse'
|
|
8
|
+
export * from './run'
|
|
9
|
+
export * from './spinner'
|
|
10
|
+
export * from './utils'
|