@stacksjs/cli 0.58.73 → 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.
@@ -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>;
@@ -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 execSync:", command);
58
- log2.debug("execSync Options:", options);
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);
@@ -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.58.73";
523
+ var version = "0.59.1";
524
524
 
525
525
  // src/helpers.ts
526
526
  async function intro(command2, options) {
@@ -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[]>;
@@ -0,0 +1,2 @@
1
+ import ora from 'ora';
2
+ export declare const spinner: typeof ora;
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/cli",
3
3
  "type": "module",
4
- "version": "0.58.73",
4
+ "version": "0.59.1",
5
5
  "description": "TypeScript framework for CLI artisans. Build beautiful console apps with ease.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
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 execSync:', command)
88
- log.debug('execSync Options:', options)
87
+ log.debug('Running ExecSync:', command)
88
+ log.debug('ExecSync Options:', options)
89
89
 
90
90
  const cmd = Array.isArray(command)
91
91
  ? command