1 |
|
2 | import { Task } from './task';
|
3 | import { Writable } from 'stream';
|
4 | import { ShellContext } from './exec';
|
5 | export interface GlobalOptions {
|
6 | |
7 |
|
8 |
|
9 | loading?: boolean;
|
10 | indent?: number;
|
11 | |
12 |
|
13 |
|
14 |
|
15 | strict?: boolean;
|
16 | |
17 |
|
18 |
|
19 |
|
20 | logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
21 | |
22 |
|
23 |
|
24 |
|
25 | logCommand?: boolean;
|
26 | options?: any;
|
27 | rawArgs?: string[];
|
28 | |
29 |
|
30 |
|
31 |
|
32 | redirectLog?: boolean | string | Writable;
|
33 | }
|
34 | export interface RunDepOptions {
|
35 | rawArgs?: string[];
|
36 | parentCtx?: TaskContext | null;
|
37 |
|
38 | loading?: boolean;
|
39 | indent?: number;
|
40 | }
|
41 | export interface RunTaskOptions extends RunDepOptions {
|
42 | options?: any;
|
43 | rawArgs?: string[];
|
44 | parentCtx?: TaskContext | null;
|
45 | force?: boolean;
|
46 | }
|
47 | export declare enum TaskState {
|
48 | waiting = "waiting",
|
49 | pending = "pending",
|
50 | skipped = "skipped",
|
51 | loading = "loading",
|
52 | succeeded = "succeeded",
|
53 | failed = "failed"
|
54 | }
|
55 | export interface DepsTree {
|
56 | uid: string;
|
57 | task: Task;
|
58 | asyncDeps: DepsTree[];
|
59 | syncDeps: DepsTree[];
|
60 | state: TaskState;
|
61 | depth: number;
|
62 | }
|
63 | export declare class TaskContext<O = any> extends ShellContext {
|
64 | task: Task<O>;
|
65 | global: GlobalOptions;
|
66 | fs: {
|
67 | access: typeof import("fs").access.__promisify__;
|
68 | open: typeof import("fs").open.__promisify__;
|
69 | rename: typeof import("fs").rename.__promisify__;
|
70 | truncate: typeof import("fs").truncate.__promisify__;
|
71 | rmdir: typeof import("fs").rmdir.__promisify__;
|
72 | mkdir: typeof import("fs").mkdir.__promisify__;
|
73 | readdir: typeof import("fs").readdir.__promisify__;
|
74 | readlink: typeof import("fs").readlink.__promisify__;
|
75 | symlink: typeof import("fs").symlink.__promisify__;
|
76 | lstat: typeof import("fs").lstat.__promisify__;
|
77 | stat: typeof import("fs").stat.__promisify__;
|
78 | link: (arg1: import("fs").PathLike, arg2: import("fs").PathLike) => Promise<void>;
|
79 | unlink: typeof import("fs").unlink.__promisify__;
|
80 | chmod: typeof import("fs").chmod.__promisify__;
|
81 | chown: typeof import("fs").chown.__promisify__;
|
82 | utimes: typeof import("fs").utimes.__promisify__;
|
83 | realpath: typeof import("fs").realpath.__promisify__;
|
84 | mkdtemp: typeof import("fs").mkdtemp.__promisify__;
|
85 | writeFile: typeof import("fs").writeFile.__promisify__;
|
86 | appendFile: typeof import("fs").appendFile.__promisify__;
|
87 | readFile: typeof import("fs").readFile.__promisify__;
|
88 | existsSync: typeof import("fs").existsSync;
|
89 | createReadString: typeof import("fs").createReadStream;
|
90 | createWriteStream: typeof import("fs").createWriteStream;
|
91 | constants: typeof import("fs").constants;
|
92 | watchDir: {
|
93 | (dir: string, cb: import("./fs").WatchDirHandler): void;
|
94 | (dir: string, options: import("./fs").WatchDirOptions, cb: import("./fs").WatchDirHandler): void;
|
95 | };
|
96 | copy: (src: string, dist: string, opts?: {
|
97 | skip?: ((file: string, stat: import("fs").Stats) => boolean | void | Promise<boolean | void>) | undefined;
|
98 | override?: boolean | undefined;
|
99 | } | undefined) => Promise<void>;
|
100 | exists(path: import("fs").PathLike): Promise<boolean>;
|
101 | lexists(path: import("fs").PathLike): Promise<boolean>;
|
102 | isFile(path: import("fs").PathLike): Promise<boolean>;
|
103 | isDirectory(path: import("fs").PathLike): Promise<boolean>;
|
104 | isSymbolicLink(path: import("fs").PathLike): Promise<boolean>;
|
105 | copyFile: typeof import("fs").copyFile.__promisify__ | ((src: import("fs").PathLike, dist: import("fs").PathLike) => Promise<{}>);
|
106 | mkdirp(dir: string): Promise<void>;
|
107 | mkdirpSync(dir: string): void;
|
108 | rmrf(path: string): Promise<void>;
|
109 | outputFile(path: string, data: any, options?: string | {
|
110 | encoding?: string | null | undefined;
|
111 | mode?: string | number | undefined;
|
112 | flag?: string | undefined;
|
113 | } | null | undefined): Promise<void>;
|
114 | outputFileSync(path: string, data: any, options?: string | {
|
115 | encoding?: string | null | undefined;
|
116 | mode?: string | number | undefined;
|
117 | flag?: string | undefined;
|
118 | } | null | undefined): void;
|
119 | outputJson(path: string, data: object, options?: string | {
|
120 | encoding?: string | null | undefined;
|
121 | mode?: string | number | undefined;
|
122 | flag?: string | undefined;
|
123 | space?: number | undefined;
|
124 | replacer?: ((key: string, value: any) => any) | undefined;
|
125 | } | null | undefined): Promise<void>;
|
126 | outputJsonSync(path: string, data: any, options?: string | {
|
127 | encoding?: string | null | undefined;
|
128 | mode?: string | number | undefined;
|
129 | flag?: string | undefined;
|
130 | space?: number | undefined;
|
131 | replacer?: ((key: string, value: any) => any) | undefined;
|
132 | } | null | undefined): void;
|
133 | readJson<T = any>(path: string, options?: {
|
134 | encoding?: null | undefined;
|
135 | flag?: string | undefined;
|
136 | } | null | undefined): Promise<T>;
|
137 | readJsonSync<T = any>(path: string, options?: {
|
138 | encoding?: null | undefined;
|
139 | flag?: string | undefined;
|
140 | } | null | undefined): T;
|
141 | iter(dir: string, skip: (path: string, stat: import("fs").Stats) => boolean | void | Promise<boolean | void>): Promise<void>;
|
142 | renameSync(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): void;
|
143 | truncateSync(path: import("fs").PathLike, len?: number | null | undefined): void;
|
144 | ftruncate: typeof import("fs").ftruncate;
|
145 | ftruncateSync(fd: number, len?: number | null | undefined): void;
|
146 | chownSync(path: import("fs").PathLike, uid: number, gid: number): void;
|
147 | fchown: typeof import("fs").fchown;
|
148 | fchownSync(fd: number, uid: number, gid: number): void;
|
149 | lchown: typeof import("fs").lchown;
|
150 | lchownSync(path: import("fs").PathLike, uid: number, gid: number): void;
|
151 | chmodSync(path: import("fs").PathLike, mode: string | number): void;
|
152 | fchmod: typeof import("fs").fchmod;
|
153 | fchmodSync(fd: number, mode: string | number): void;
|
154 | lchmod: typeof import("fs").lchmod;
|
155 | lchmodSync(path: import("fs").PathLike, mode: string | number): void;
|
156 | statSync(path: import("fs").PathLike): import("fs").Stats;
|
157 | fstat: typeof import("fs").fstat;
|
158 | fstatSync(fd: number): import("fs").Stats;
|
159 | lstatSync(path: import("fs").PathLike): import("fs").Stats;
|
160 | linkSync(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): void;
|
161 | symlinkSync(target: import("fs").PathLike, path: import("fs").PathLike, type?: "dir" | "file" | "junction" | null | undefined): void;
|
162 | readlinkSync(path: import("fs").PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
163 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
164 | } | null | undefined): string;
|
165 | readlinkSync(path: import("fs").PathLike, options: "buffer" | {
|
166 | encoding: "buffer";
|
167 | }): Buffer;
|
168 | readlinkSync(path: import("fs").PathLike, options?: string | {
|
169 | encoding?: string | null | undefined;
|
170 | } | null | undefined): string | Buffer;
|
171 | realpathSync: typeof import("fs").realpathSync;
|
172 | unlinkSync(path: import("fs").PathLike): void;
|
173 | rmdirSync(path: import("fs").PathLike): void;
|
174 | mkdirSync(path: import("fs").PathLike, options?: string | number | import("fs").MakeDirectoryOptions | null | undefined): void;
|
175 | mkdtempSync(prefix: string, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
176 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
177 | } | null | undefined): string;
|
178 | mkdtempSync(prefix: string, options: "buffer" | {
|
179 | encoding: "buffer";
|
180 | }): Buffer;
|
181 | mkdtempSync(prefix: string, options?: string | {
|
182 | encoding?: string | null | undefined;
|
183 | } | null | undefined): string | Buffer;
|
184 | readdirSync(path: import("fs").PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
185 | encoding: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null;
|
186 | withFileTypes?: false | undefined;
|
187 | } | null | undefined): string[];
|
188 | readdirSync(path: import("fs").PathLike, options: "buffer" | {
|
189 | encoding: "buffer";
|
190 | withFileTypes?: false | undefined;
|
191 | }): Buffer[];
|
192 | readdirSync(path: import("fs").PathLike, options?: string | {
|
193 | encoding?: string | null | undefined;
|
194 | withFileTypes?: false | undefined;
|
195 | } | null | undefined): string[] | Buffer[];
|
196 | readdirSync(path: import("fs").PathLike, options: {
|
197 | withFileTypes: true;
|
198 | }): import("fs").Dirent[];
|
199 | close: typeof import("fs").close;
|
200 | closeSync(fd: number): void;
|
201 | openSync(path: import("fs").PathLike, flags: string | number, mode?: string | number | null | undefined): number;
|
202 | utimesSync(path: import("fs").PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
203 | futimes: typeof import("fs").futimes;
|
204 | futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
|
205 | fsync: typeof import("fs").fsync;
|
206 | fsyncSync(fd: number): void;
|
207 | write: typeof import("fs").write;
|
208 | writeSync(fd: number, buffer: import("fs").BinaryData, offset?: number | null | undefined, length?: number | null | undefined, position?: number | null | undefined): number;
|
209 | writeSync(fd: number, string: any, position?: number | null | undefined, encoding?: string | null | undefined): number;
|
210 | read: typeof import("fs").read;
|
211 | readSync(fd: number, buffer: import("fs").BinaryData, offset: number, length: number, position: number | null): number;
|
212 | readFileSync(path: string | number | Buffer | import("url").URL, options?: {
|
213 | encoding?: null | undefined;
|
214 | flag?: string | undefined;
|
215 | } | null | undefined): Buffer;
|
216 | readFileSync(path: string | number | Buffer | import("url").URL, options: string | {
|
217 | encoding: string;
|
218 | flag?: string | undefined;
|
219 | }): string;
|
220 | readFileSync(path: string | number | Buffer | import("url").URL, options?: string | {
|
221 | encoding?: string | null | undefined;
|
222 | flag?: string | undefined;
|
223 | } | null | undefined): string | Buffer;
|
224 | writeFileSync(path: string | number | Buffer | import("url").URL, data: any, options?: string | {
|
225 | encoding?: string | null | undefined;
|
226 | mode?: string | number | undefined;
|
227 | flag?: string | undefined;
|
228 | } | null | undefined): void;
|
229 | appendFileSync(file: string | number | Buffer | import("url").URL, data: any, options?: string | {
|
230 | encoding?: string | null | undefined;
|
231 | mode?: string | number | undefined;
|
232 | flag?: string | undefined;
|
233 | } | null | undefined): void;
|
234 | watchFile(filename: import("fs").PathLike, options: {
|
235 | persistent?: boolean | undefined;
|
236 | interval?: number | undefined;
|
237 | } | undefined, listener: (curr: import("fs").Stats, prev: import("fs").Stats) => void): void;
|
238 | watchFile(filename: import("fs").PathLike, listener: (curr: import("fs").Stats, prev: import("fs").Stats) => void): void;
|
239 | unwatchFile(filename: import("fs").PathLike, listener?: ((curr: import("fs").Stats, prev: import("fs").Stats) => void) | undefined): void;
|
240 | watch(filename: import("fs").PathLike, options: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
241 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
242 | persistent?: boolean | undefined;
|
243 | recursive?: boolean | undefined;
|
244 | } | null | undefined, listener?: ((event: string, filename: string) => void) | undefined): import("fs").FSWatcher;
|
245 | watch(filename: import("fs").PathLike, options: "buffer" | {
|
246 | encoding: "buffer";
|
247 | persistent?: boolean | undefined;
|
248 | recursive?: boolean | undefined;
|
249 | }, listener?: ((event: string, filename: Buffer) => void) | undefined): import("fs").FSWatcher;
|
250 | watch(filename: import("fs").PathLike, options: string | {
|
251 | encoding?: string | null | undefined;
|
252 | persistent?: boolean | undefined;
|
253 | recursive?: boolean | undefined;
|
254 | } | null, listener?: ((event: string, filename: string | Buffer) => void) | undefined): import("fs").FSWatcher;
|
255 | watch(filename: import("fs").PathLike, listener?: ((event: string, filename: string) => any) | undefined): import("fs").FSWatcher;
|
256 | accessSync(path: import("fs").PathLike, mode?: number | undefined): void;
|
257 | createReadStream(path: import("fs").PathLike, options?: string | {
|
258 | flags?: string | undefined;
|
259 | encoding?: string | undefined;
|
260 | fd?: number | undefined;
|
261 | mode?: number | undefined;
|
262 | autoClose?: boolean | undefined;
|
263 | start?: number | undefined;
|
264 | end?: number | undefined;
|
265 | highWaterMark?: number | undefined;
|
266 | } | undefined): import("fs").ReadStream;
|
267 | fdatasync: typeof import("fs").fdatasync;
|
268 | fdatasyncSync(fd: number): void;
|
269 | copyFileSync(src: import("fs").PathLike, dest: import("fs").PathLike, flags?: number | undefined): void;
|
270 | Stats: typeof import("fs").Stats;
|
271 | Dirent: typeof import("fs").Dirent;
|
272 | ReadStream: typeof import("fs").ReadStream;
|
273 | WriteStream: typeof import("fs").WriteStream;
|
274 | promises: typeof import("fs").promises;
|
275 | };
|
276 | debug: (...args: any[]) => void;
|
277 | info: (...args: any[]) => void;
|
278 | log: (...args: any[]) => void;
|
279 | warn: (...args: any[]) => void;
|
280 | error: (...args: any[]) => void;
|
281 | constructor(task: Task<O>, global: GlobalOptions);
|
282 | readonly options: O;
|
283 | run(task: string | Task, options?: RunTaskOptions): Promise<void>;
|
284 | }
|
285 | export declare class TaskManager {
|
286 | private _tasks;
|
287 | private _didSet;
|
288 | globalOptions: GlobalOptions;
|
289 | getTasks(): Task<any>[];
|
290 | addTask(task: Task): Task<any>;
|
291 | resolveDependencyTree(t: Task, depth?: number): DepsTree;
|
292 | isLoading(t: Task, props: RunTaskOptions): boolean;
|
293 | runDepsTree(depsTree: DepsTree, props: RunTaskOptions): Promise<void>;
|
294 | run(name?: string | Task, props?: RunTaskOptions): Promise<void>;
|
295 | }
|