1 | import { ILoggerProps } from './logger';
|
2 | import { DepBuilder } from './dep-builder';
|
3 | import { GlobalOptions, TaskContext } from './task-manager';
|
4 | interface OptionConfig {
|
5 | default?: any;
|
6 | type?: any[];
|
7 | }
|
8 | export declare type OptionDef = [string, string, OptionConfig | undefined];
|
9 | export declare type TaskFn<O, T = any> = (ctx: TaskContext<O>) => T | Promise<T>;
|
10 | export interface TaskDep<O = any> {
|
11 | name: string;
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | async?: boolean | number;
|
19 | |
20 |
|
21 |
|
22 | force?: boolean;
|
23 | |
24 |
|
25 |
|
26 | options?: O;
|
27 | resolveOptions?: (ctx: TaskContext) => Promise<O> | O;
|
28 | [k: string]: any;
|
29 | }
|
30 | export declare type Dependency = TaskDep | string | DepBuilder;
|
31 | export interface Task<O = any> extends TaskDep<O> {
|
32 | namespaces: string[];
|
33 | dependencies?: TaskDep[];
|
34 | desc?: string;
|
35 | fn?: (ctx: TaskContext<O>) => void | Promise<void>;
|
36 | |
37 |
|
38 |
|
39 | rawArgs: string[];
|
40 | |
41 |
|
42 |
|
43 |
|
44 | strict?: boolean;
|
45 | options: O;
|
46 | |
47 |
|
48 |
|
49 |
|
50 | loading?: boolean;
|
51 | |
52 |
|
53 |
|
54 |
|
55 | logCommand?: boolean;
|
56 | logger?: ILoggerProps;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export declare function setGlobalOptions(options: GlobalOptions): void;
|
63 | export declare const before: (fn: (t: Task) => void | Promise<void>) => void;
|
64 | export declare const after: (fn: (t: Task) => void | Promise<void>) => void;
|
65 | export declare const onerror: (fn: (err: Error, t: Task) => void | Promise<void>) => void;
|
66 | declare namespace TaskOptions {
|
67 | let last: {
|
68 | desc: string | undefined;
|
69 | optionDefs: OptionDef[];
|
70 | strict: boolean | undefined;
|
71 | loading: boolean | undefined;
|
72 | };
|
73 | function empty(): {
|
74 | desc: string | undefined;
|
75 | optionDefs: OptionDef[];
|
76 | strict: boolean | undefined;
|
77 | loading: boolean | undefined;
|
78 | };
|
79 | }
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export declare function desc(desc: string): void;
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | export declare function option(rawName: string, description: string, config?: OptionConfig): void;
|
92 |
|
93 |
|
94 |
|
95 | export declare function strict(): void;
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | export declare function setOption(options: Partial<typeof TaskOptions.last>): void;
|
101 | export declare function task<O>(name: string, fn: TaskFn<O>): Task<O>;
|
102 | export declare function task<O>(name: string, dependencies: Dependency[], fn?: TaskFn<O>): Task<O>;
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | export declare function namespace(ns: string, fn: (ns: string) => void): void;
|
126 | export {};
|