@stacksjs/cli 0.58.72 → 0.59.1
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/actions/index.d.ts +1 -0
- package/dist/actions/install.d.ts +27 -0
- package/dist/cli.d.ts +12 -0
- package/dist/command.d.ts +33 -0
- package/dist/console.d.ts +18 -0
- package/dist/exec.d.ts +40 -0
- package/dist/helpers.d.ts +9 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +4 -4
- package/dist/parse.d.ts +17 -0
- package/dist/run.d.ts +63 -0
- package/dist/spinner.d.ts +2 -0
- package/dist/utils.d.ts +4 -0
- package/package.json +1 -1
- package/src/exec.ts +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './install';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExecaReturnValue } from 'execa';
|
|
2
|
+
interface InstallPackageOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
dev?: boolean;
|
|
5
|
+
silent?: boolean;
|
|
6
|
+
packageManager?: string;
|
|
7
|
+
packageManagerVersion?: string;
|
|
8
|
+
preferOffline?: boolean;
|
|
9
|
+
additionalArgs?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Install an npm package.
|
|
13
|
+
*
|
|
14
|
+
* @param name - The package name to install.
|
|
15
|
+
* @param options - The options to pass to the install.The options to pass to the install.
|
|
16
|
+
* @returns The result of the install.
|
|
17
|
+
*/
|
|
18
|
+
export declare function installPackage(name: string, options?: InstallPackageOptions): Promise<ExecaReturnValue<string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Install a Stack into your project.
|
|
21
|
+
*
|
|
22
|
+
* @param name - The Stack name to install.
|
|
23
|
+
* @param options - The options to pass to the install.
|
|
24
|
+
* @returns The result of the install.
|
|
25
|
+
*/
|
|
26
|
+
export declare function installStack(name: string, options?: InstallPackageOptions): Promise<ExecaReturnValue<string>>;
|
|
27
|
+
export {};
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CAC } from 'cac';
|
|
2
|
+
export interface ParsedArgv {
|
|
3
|
+
args: ReadonlyArray<string>;
|
|
4
|
+
options: {
|
|
5
|
+
[k: string]: any;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
interface CliOptions {
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function cli(name?: string | CliOptions, options?: CliOptions): CAC;
|
|
12
|
+
export { CAC };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CliOptions } from '@stacksjs/types';
|
|
2
|
+
type CommandOptionTuple = [string, string, {
|
|
3
|
+
default: boolean;
|
|
4
|
+
}];
|
|
5
|
+
interface CommandOptionObject {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
default: boolean | string;
|
|
9
|
+
}
|
|
10
|
+
type CommandOptions = CommandOptionTuple | CommandOptionObject[];
|
|
11
|
+
interface Options {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
active: boolean;
|
|
15
|
+
options: CommandOptions;
|
|
16
|
+
run: (options?: CliOptions) => Promise<any>;
|
|
17
|
+
onFail: (error: Error) => void;
|
|
18
|
+
onSuccess: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare class Command {
|
|
21
|
+
name: Options['name'];
|
|
22
|
+
description: Options['description'];
|
|
23
|
+
options: Options['options'];
|
|
24
|
+
run: Options['run'];
|
|
25
|
+
onFail: Options['onFail'];
|
|
26
|
+
onSuccess: Options['onSuccess'];
|
|
27
|
+
constructor({ name, description, options, run, onFail, onSuccess }: Options);
|
|
28
|
+
}
|
|
29
|
+
export declare const command: {
|
|
30
|
+
run: (command: string, options?: any) => Promise<Result<Subprocess, CommandError>>;
|
|
31
|
+
runSync: (command: string, options?: any) => Promise<Result<Subprocess, CommandError>>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { log, logger } from '@stacksjs/logging';
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
export declare class Prompt {
|
|
4
|
+
private required;
|
|
5
|
+
constructor();
|
|
6
|
+
require(): this;
|
|
7
|
+
isRequired(): boolean;
|
|
8
|
+
select(message: any, options: any): Promise<any>;
|
|
9
|
+
checkbox(message: any, options: any): Promise<any>;
|
|
10
|
+
confirm(message: any, options: any): Promise<any>;
|
|
11
|
+
input(message: any, options: any): Promise<any>;
|
|
12
|
+
password(message: any, options: any): Promise<any>;
|
|
13
|
+
number(message: any, options: any): Promise<any>;
|
|
14
|
+
multiselect(message: any, options: any): Promise<any>;
|
|
15
|
+
autocomplete(message: any, options: any): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
export { prompts, logger, log };
|
|
18
|
+
export declare const prompt: () => Prompt;
|
package/dist/exec.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Result } from '@stacksjs/error-handling';
|
|
2
|
+
import type { CliOptions, Subprocess } from '@stacksjs/types';
|
|
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
|
+
*/
|
|
23
|
+
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
|
+
export declare function execSync(command: string | string[], options?: CliOptions): Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IntroOptions, OutroOptions } from '@stacksjs/types';
|
|
2
|
+
/**
|
|
3
|
+
* Prints the intro message.
|
|
4
|
+
*/
|
|
5
|
+
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<unknown>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './actions';
|
|
2
|
+
export * from './cli';
|
|
3
|
+
export * from './command';
|
|
4
|
+
export * from './console';
|
|
5
|
+
export * from './helpers';
|
|
6
|
+
export * from './parse';
|
|
7
|
+
export * from './exec';
|
|
8
|
+
export * from './run';
|
|
9
|
+
export * from './spinner';
|
|
10
|
+
export * from './utils';
|
package/dist/index.js
CHANGED
|
@@ -54,8 +54,8 @@ async function exec(command, options) {
|
|
|
54
54
|
return err(handleError(`Failed to execute command: ${cmd.join(" ")}`));
|
|
55
55
|
}
|
|
56
56
|
async function execSync(command, options) {
|
|
57
|
-
log2.debug("Running
|
|
58
|
-
log2.debug("
|
|
57
|
+
log2.debug("Running ExecSync:", command);
|
|
58
|
+
log2.debug("ExecSync Options:", options);
|
|
59
59
|
const cmd = Array.isArray(command) ? command : command.match(/(?:[^\s"]+|"[^"]*")+/g);
|
|
60
60
|
if (!cmd) {
|
|
61
61
|
log2.error(`Failed to parse command: ${cmd}`, options);
|
|
@@ -79,7 +79,7 @@ async function execSync(command, options) {
|
|
|
79
79
|
import {collect} from "@stacksjs/collections";
|
|
80
80
|
import * as kolorist from "kolorist";
|
|
81
81
|
|
|
82
|
-
//
|
|
82
|
+
// ../../../../node_modules/consola/dist/utils.mjs
|
|
83
83
|
import * as tty from "tty";
|
|
84
84
|
var replaceClose = function(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
85
85
|
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
@@ -520,7 +520,7 @@ import {log as log3} from "@stacksjs/logging";
|
|
|
520
520
|
import {ExitCode as ExitCode2} from "@stacksjs/types";
|
|
521
521
|
import {bgCyan as bgCyan2, bold as bold2, cyan as cyan2, dim as dim2, gray as gray2, green as green2, italic as italic2} from "kolorist";
|
|
522
522
|
// package.json
|
|
523
|
-
var version = "0.
|
|
523
|
+
var version = "0.59.1";
|
|
524
524
|
|
|
525
525
|
// src/helpers.ts
|
|
526
526
|
async function intro(command2, options) {
|
package/dist/parse.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ParsedArgv {
|
|
2
|
+
args: string[];
|
|
3
|
+
options: {
|
|
4
|
+
[k: string]: string | boolean | number;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare function parseArgv(argv?: string[]): ParsedArgv;
|
|
8
|
+
export declare function parseArgs(argv?: string[]): string[];
|
|
9
|
+
interface CliOptions {
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
quiet?: boolean;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
[k: string]: string | boolean | number | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseOptions(options?: CliOptions): CliOptions;
|
|
16
|
+
export declare function buddyOptions(options?: any): string;
|
|
17
|
+
export {};
|
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { CliOptions, CommandError, Subprocess } from '@stacksjs/types';
|
|
2
|
+
import type { Result } from '@stacksjs/error-handling';
|
|
3
|
+
/**
|
|
4
|
+
* Run a command.
|
|
5
|
+
*
|
|
6
|
+
* @param command The command to run.
|
|
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 runCommand('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 runCommand('ls', { cwd: '/home' })
|
|
21
|
+
*
|
|
22
|
+
* if (result.isErr())
|
|
23
|
+
* console.error(result.error)
|
|
24
|
+
* else
|
|
25
|
+
* console.log(result)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function runCommand(command: string, options?: CliOptions): Promise<Result<Subprocess, CommandError>>;
|
|
29
|
+
export declare function runProcess(command: string, options?: CliOptions): Promise<Result<Subprocess, CommandError>>;
|
|
30
|
+
/**
|
|
31
|
+
* Run a command.
|
|
32
|
+
*
|
|
33
|
+
* @param command The command to run.
|
|
34
|
+
* @param options The options to pass to the command.
|
|
35
|
+
* @returns The result of the command.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const result = runCommandSync('ls')
|
|
39
|
+
*
|
|
40
|
+
* if (result.isErr())
|
|
41
|
+
* console.error(result.error)
|
|
42
|
+
* else
|
|
43
|
+
* console.log(result)
|
|
44
|
+
* ```
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const result = runCommandSync('ls', { cwd: '/home' })
|
|
48
|
+
*
|
|
49
|
+
* if (result.isErr())
|
|
50
|
+
* console.error(result.error)
|
|
51
|
+
* else
|
|
52
|
+
* console.log(result)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function runCommandSync(command: string, options?: CliOptions): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Run many commands.
|
|
58
|
+
*
|
|
59
|
+
* @param commands The command to run.
|
|
60
|
+
* @param options The options to pass to the command.
|
|
61
|
+
* @returns The result of the command.
|
|
62
|
+
*/
|
|
63
|
+
export declare function runCommands(commands: string[], options?: CliOptions): Promise<any[]>;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * as kolorist from 'kolorist';
|
|
2
|
+
export { stripAnsi, centerAlign, rightAlign, leftAlign, align, box, colors, getColor, colorize, } from 'consola/utils';
|
|
3
|
+
export { ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, red, reset, strikethrough, underline, white, yellow, ansi256, trueColor, trueColorBg, stripColors, } from 'kolorist';
|
|
4
|
+
export declare const quotes: any;
|
package/package.json
CHANGED
package/src/exec.ts
CHANGED
|
@@ -84,8 +84,8 @@ export async function exec(command: string | string[], options?: CliOptions): Pr
|
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
export async function execSync(command: string | string[], options?: CliOptions): Promise<string> {
|
|
87
|
-
log.debug('Running
|
|
88
|
-
log.debug('
|
|
87
|
+
log.debug('Running ExecSync:', command)
|
|
88
|
+
log.debug('ExecSync Options:', options)
|
|
89
89
|
|
|
90
90
|
const cmd = Array.isArray(command)
|
|
91
91
|
? command
|