UNPKG

1.46 kBTypeScriptView Raw
1import execa, { Options as ExecaOptions } from 'execa';
2import { Arguments, ParserOptions } from '@boost/args';
3import { Blueprint, Predicates } from '@boost/common';
4import { ConcurrentEvent } from '@boost/event';
5import { Plugin } from '@boost/plugin';
6import { ScriptContext } from './contexts/ScriptContext';
7import { Argv, BeemoTool, Scriptable } from './types';
8export declare abstract class Script<O extends object = {}, Options extends object = {}> extends Plugin<BeemoTool, Options> implements Scriptable<O> {
9 tool: BeemoTool;
10 readonly onBeforeExecute: ConcurrentEvent<[ScriptContext, Argv], string>;
11 readonly onAfterExecute: ConcurrentEvent<[ScriptContext, unknown], string>;
12 readonly onFailedExecute: ConcurrentEvent<[ScriptContext, Error], string>;
13 static validate(script: Script): void;
14 blueprint(preds: Predicates): Blueprint<object>;
15 bootstrap(): void;
16 startup(tool: BeemoTool): void;
17 /**
18 * Define a configuration object to parse args with.
19 */
20 parse(): ParserOptions<O>;
21 /**
22 * Execute a command with the given arguments and pass the results through a promise.
23 */
24 executeCommand(command: string, args: string[], options?: ExecaOptions): Promise<execa.ExecaReturnValue<string>>;
25 /**
26 * Execute the script with the context and parsed args.
27 */
28 abstract execute(context: ScriptContext, args: Arguments<O>): Promise<unknown>;
29}
30//# sourceMappingURL=Script.d.ts.map
\No newline at end of file