///
import { Task } from './task';
import { Writable } from 'stream';
import { ShellContext } from './exec';
export interface GlobalOptions {
/**
* @default true
*/
loading?: boolean;
indent?: number;
/**
* @description Whether task options only allow defined options, default false
* @default false
*/
strict?: boolean;
/**
* @description log level
* @default 'debug'
*/
logLevel?: 'debug' | 'info' | 'warn' | 'error';
/**
* @description whether log command when execute command
* @default true
*/
logCommand?: boolean;
options?: any;
rawArgs?: string[];
/**
* @description whether redirect all ctx.exec & ctx.spawn's output to file
* @default false Default will write to process.stdout & process.stderr
*/
redirectLog?: boolean | string | Writable;
}
export interface RunDepOptions {
rawArgs?: string[];
parentCtx?: TaskContext | null;
/** default is false */
loading?: boolean;
indent?: number;
}
export interface RunTaskOptions extends RunDepOptions {
options?: any;
rawArgs?: string[];
parentCtx?: TaskContext | null;
force?: boolean;
}
export declare enum TaskState {
waiting = "waiting",
pending = "pending",
skipped = "skipped",
loading = "loading",
succeeded = "succeeded",
failed = "failed"
}
export interface DepsTree {
uid: string;
task: Task;
asyncDeps: DepsTree[];
syncDeps: DepsTree[];
state: TaskState;
depth: number;
}
export declare class TaskContext extends ShellContext {
task: Task;
global: GlobalOptions;
fs: {
access: typeof import("fs").access.__promisify__;
open: typeof import("fs").open.__promisify__;
rename: typeof import("fs").rename.__promisify__;
truncate: typeof import("fs").truncate.__promisify__;
rmdir: typeof import("fs").rmdir.__promisify__;
mkdir: typeof import("fs").mkdir.__promisify__;
readdir: typeof import("fs").readdir.__promisify__;
readlink: typeof import("fs").readlink.__promisify__;
symlink: typeof import("fs").symlink.__promisify__;
lstat: typeof import("fs").lstat.__promisify__;
stat: typeof import("fs").stat.__promisify__;
link: (arg1: import("fs").PathLike, arg2: import("fs").PathLike) => Promise;
unlink: typeof import("fs").unlink.__promisify__;
chmod: typeof import("fs").chmod.__promisify__;
chown: typeof import("fs").chown.__promisify__;
utimes: typeof import("fs").utimes.__promisify__;
realpath: typeof import("fs").realpath.__promisify__;
mkdtemp: typeof import("fs").mkdtemp.__promisify__;
writeFile: typeof import("fs").writeFile.__promisify__;
appendFile: typeof import("fs").appendFile.__promisify__;
readFile: typeof import("fs").readFile.__promisify__;
existsSync: typeof import("fs").existsSync;
createReadString: typeof import("fs").createReadStream;
createWriteStream: typeof import("fs").createWriteStream;
constants: typeof import("fs").constants;
watchDir: {
(dir: string, cb: import("./fs").WatchDirHandler): void;
(dir: string, options: import("./fs").WatchDirOptions, cb: import("./fs").WatchDirHandler): void;
};
copy: (src: string, dist: string, opts?: {
skip?: ((file: string, stat: import("fs").Stats) => boolean | void | Promise) | undefined;
override?: boolean | undefined;
} | undefined) => Promise;
exists(path: import("fs").PathLike): Promise;
lexists(path: import("fs").PathLike): Promise;
isFile(path: import("fs").PathLike): Promise;
isDirectory(path: import("fs").PathLike): Promise;
isSymbolicLink(path: import("fs").PathLike): Promise;
copyFile: typeof import("fs").copyFile.__promisify__ | ((src: import("fs").PathLike, dist: import("fs").PathLike) => Promise<{}>);
mkdirp(dir: string): Promise;
mkdirpSync(dir: string): void;
rmrf(path: string): Promise;
outputFile(path: string, data: any, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
} | null | undefined): Promise;
outputFileSync(path: string, data: any, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
} | null | undefined): void;
outputJson(path: string, data: object, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} | null | undefined): Promise;
outputJsonSync(path: string, data: any, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} | null | undefined): void;
readJson(path: string, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): Promise;
readJsonSync(path: string, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): T;
iter(dir: string, skip: (path: string, stat: import("fs").Stats) => boolean | void | Promise): Promise;
renameSync(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): void;
truncateSync(path: import("fs").PathLike, len?: number | null | undefined): void;
ftruncate: typeof import("fs").ftruncate;
ftruncateSync(fd: number, len?: number | null | undefined): void;
chownSync(path: import("fs").PathLike, uid: number, gid: number): void;
fchown: typeof import("fs").fchown;
fchownSync(fd: number, uid: number, gid: number): void;
lchown: typeof import("fs").lchown;
lchownSync(path: import("fs").PathLike, uid: number, gid: number): void;
chmodSync(path: import("fs").PathLike, mode: string | number): void;
fchmod: typeof import("fs").fchmod;
fchmodSync(fd: number, mode: string | number): void;
lchmod: typeof import("fs").lchmod;
lchmodSync(path: import("fs").PathLike, mode: string | number): void;
statSync(path: import("fs").PathLike): import("fs").Stats;
fstat: typeof import("fs").fstat;
fstatSync(fd: number): import("fs").Stats;
lstatSync(path: import("fs").PathLike): import("fs").Stats;
linkSync(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): void;
symlinkSync(target: import("fs").PathLike, path: import("fs").PathLike, type?: "dir" | "file" | "junction" | null | undefined): void;
readlinkSync(path: import("fs").PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
} | null | undefined): string;
readlinkSync(path: import("fs").PathLike, options: "buffer" | {
encoding: "buffer";
}): Buffer;
readlinkSync(path: import("fs").PathLike, options?: string | {
encoding?: string | null | undefined;
} | null | undefined): string | Buffer;
realpathSync: typeof import("fs").realpathSync;
unlinkSync(path: import("fs").PathLike): void;
rmdirSync(path: import("fs").PathLike): void;
mkdirSync(path: import("fs").PathLike, options?: string | number | import("fs").MakeDirectoryOptions | null | undefined): void;
mkdtempSync(prefix: string, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
} | null | undefined): string;
mkdtempSync(prefix: string, options: "buffer" | {
encoding: "buffer";
}): Buffer;
mkdtempSync(prefix: string, options?: string | {
encoding?: string | null | undefined;
} | null | undefined): string | Buffer;
readdirSync(path: import("fs").PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
encoding: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null;
withFileTypes?: false | undefined;
} | null | undefined): string[];
readdirSync(path: import("fs").PathLike, options: "buffer" | {
encoding: "buffer";
withFileTypes?: false | undefined;
}): Buffer[];
readdirSync(path: import("fs").PathLike, options?: string | {
encoding?: string | null | undefined;
withFileTypes?: false | undefined;
} | null | undefined): string[] | Buffer[];
readdirSync(path: import("fs").PathLike, options: {
withFileTypes: true;
}): import("fs").Dirent[];
close: typeof import("fs").close;
closeSync(fd: number): void;
openSync(path: import("fs").PathLike, flags: string | number, mode?: string | number | null | undefined): number;
utimesSync(path: import("fs").PathLike, atime: string | number | Date, mtime: string | number | Date): void;
futimes: typeof import("fs").futimes;
futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
fsync: typeof import("fs").fsync;
fsyncSync(fd: number): void;
write: typeof import("fs").write;
writeSync(fd: number, buffer: import("fs").BinaryData, offset?: number | null | undefined, length?: number | null | undefined, position?: number | null | undefined): number;
writeSync(fd: number, string: any, position?: number | null | undefined, encoding?: string | null | undefined): number;
read: typeof import("fs").read;
readSync(fd: number, buffer: import("fs").BinaryData, offset: number, length: number, position: number | null): number;
readFileSync(path: string | number | Buffer | import("url").URL, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): Buffer;
readFileSync(path: string | number | Buffer | import("url").URL, options: string | {
encoding: string;
flag?: string | undefined;
}): string;
readFileSync(path: string | number | Buffer | import("url").URL, options?: string | {
encoding?: string | null | undefined;
flag?: string | undefined;
} | null | undefined): string | Buffer;
writeFileSync(path: string | number | Buffer | import("url").URL, data: any, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
} | null | undefined): void;
appendFileSync(file: string | number | Buffer | import("url").URL, data: any, options?: string | {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
} | null | undefined): void;
watchFile(filename: import("fs").PathLike, options: {
persistent?: boolean | undefined;
interval?: number | undefined;
} | undefined, listener: (curr: import("fs").Stats, prev: import("fs").Stats) => void): void;
watchFile(filename: import("fs").PathLike, listener: (curr: import("fs").Stats, prev: import("fs").Stats) => void): void;
unwatchFile(filename: import("fs").PathLike, listener?: ((curr: import("fs").Stats, prev: import("fs").Stats) => void) | undefined): void;
watch(filename: import("fs").PathLike, options: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
persistent?: boolean | undefined;
recursive?: boolean | undefined;
} | null | undefined, listener?: ((event: string, filename: string) => void) | undefined): import("fs").FSWatcher;
watch(filename: import("fs").PathLike, options: "buffer" | {
encoding: "buffer";
persistent?: boolean | undefined;
recursive?: boolean | undefined;
}, listener?: ((event: string, filename: Buffer) => void) | undefined): import("fs").FSWatcher;
watch(filename: import("fs").PathLike, options: string | {
encoding?: string | null | undefined;
persistent?: boolean | undefined;
recursive?: boolean | undefined;
} | null, listener?: ((event: string, filename: string | Buffer) => void) | undefined): import("fs").FSWatcher;
watch(filename: import("fs").PathLike, listener?: ((event: string, filename: string) => any) | undefined): import("fs").FSWatcher;
accessSync(path: import("fs").PathLike, mode?: number | undefined): void;
createReadStream(path: import("fs").PathLike, options?: string | {
flags?: string | undefined;
encoding?: string | undefined;
fd?: number | undefined;
mode?: number | undefined;
autoClose?: boolean | undefined;
start?: number | undefined;
end?: number | undefined;
highWaterMark?: number | undefined;
} | undefined): import("fs").ReadStream;
fdatasync: typeof import("fs").fdatasync;
fdatasyncSync(fd: number): void;
copyFileSync(src: import("fs").PathLike, dest: import("fs").PathLike, flags?: number | undefined): void;
Stats: typeof import("fs").Stats;
Dirent: typeof import("fs").Dirent;
ReadStream: typeof import("fs").ReadStream;
WriteStream: typeof import("fs").WriteStream;
promises: typeof import("fs").promises;
};
debug: (...args: any[]) => void;
info: (...args: any[]) => void;
log: (...args: any[]) => void;
warn: (...args: any[]) => void;
error: (...args: any[]) => void;
constructor(task: Task, global: GlobalOptions);
readonly options: O;
run(task: string | Task, options?: RunTaskOptions): Promise;
}
export declare class TaskManager {
private _tasks;
private _didSet;
globalOptions: GlobalOptions;
getTasks(): Task[];
addTask(task: Task): Task;
resolveDependencyTree(t: Task, depth?: number): DepsTree;
isLoading(t: Task, props: RunTaskOptions): boolean;
runDepsTree(depsTree: DepsTree, props: RunTaskOptions): Promise;
run(name?: string | Task, props?: RunTaskOptions): Promise;
}