1 |
|
2 | import { OptionConfig } from 'cac/types/Option';
|
3 | import { DepBuilder } from './dep-builder';
|
4 | import { GlobalOptions, TaskContext } from './task-manager';
|
5 | import { Writable } from 'stream';
|
6 | export declare type OptionDef = [string, string, OptionConfig | undefined];
|
7 | export declare type TaskFn<O> = (ctx: TaskContext<O>) => void | Promise<void>;
|
8 | export interface TaskDep<O = any> {
|
9 | name: string;
|
10 | |
11 |
|
12 |
|
13 |
|
14 | async?: boolean;
|
15 | |
16 |
|
17 |
|
18 | force?: boolean;
|
19 | |
20 |
|
21 |
|
22 | options?: O;
|
23 | resolveOptions?: (ctx: TaskContext) => Promise<O> | O;
|
24 | [k: string]: any;
|
25 | }
|
26 | export declare type Dependency = TaskDep | string | DepBuilder;
|
27 | export interface Task<O = any> extends TaskDep<O> {
|
28 | dependencies?: TaskDep[];
|
29 | desc?: string;
|
30 | fn?: (ctx: TaskContext<O>) => void | Promise<void>;
|
31 | |
32 |
|
33 |
|
34 | rawArgs: string[];
|
35 | |
36 |
|
37 |
|
38 |
|
39 | strict?: boolean;
|
40 | options: O;
|
41 | |
42 |
|
43 |
|
44 |
|
45 | loading?: boolean;
|
46 | |
47 |
|
48 |
|
49 |
|
50 | logCommand?: boolean;
|
51 | |
52 |
|
53 |
|
54 |
|
55 | redirectLog?: boolean | string | Writable;
|
56 | }
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | export declare function setGlobalOptions(options: GlobalOptions): void;
|
62 | declare namespace TaskOptions {
|
63 | let last: {
|
64 | desc: string | undefined;
|
65 | optionDefs: [string, string, OptionConfig | undefined][];
|
66 | strict: boolean | undefined;
|
67 | loading: boolean | undefined;
|
68 | };
|
69 | function empty(): {
|
70 | desc: string | undefined;
|
71 | optionDefs: [string, string, OptionConfig | undefined][];
|
72 | strict: boolean | undefined;
|
73 | loading: boolean | undefined;
|
74 | };
|
75 | }
|
76 | export declare function desc(desc: string): void;
|
77 | export declare function option(rawName: string, description: string, config?: OptionConfig): void;
|
78 | export declare function strict(): void;
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | export declare function setOption(options: Partial<typeof TaskOptions.last>): void;
|
84 | export declare function task<O>(name: string, fn: TaskFn<O>): Task<O>;
|
85 | export declare function task<O>(name: string, dependencies: Dependency[], fn?: TaskFn<O>): Task<O>;
|
86 | export {};
|