///
import { OptionConfig } from 'cac/types/Option';
import { DepBuilder } from './dep-builder';
import { GlobalOptions, TaskContext } from './task-manager';
import { Writable } from 'stream';
export declare type OptionDef = [string, string, OptionConfig | undefined];
export declare type TaskFn = (ctx: TaskContext) => void | Promise;
export interface TaskDep {
name: string;
/**
* Dependences are executed serially by default.
* If order doesn't matter and you want better performance via parallel, you can mark it as asynchronized.
*/
async?: boolean;
/**
* Whether rerun it when it occured in dependences tree more then once.
*/
force?: boolean;
/**
* Parsed options
*/
options?: O;
resolveOptions?: (ctx: TaskContext) => Promise | O;
[k: string]: any;
}
export declare type Dependency = TaskDep | string | DepBuilder;
export interface Task extends TaskDep {
dependencies?: TaskDep[];
desc?: string;
fn?: (ctx: TaskContext) => void | Promise;
/**
* Raw arg strings
*/
rawArgs: string[];
/**
* @description Whether task options only allow defined options, default false
* @default false
*/
strict?: boolean;
options: O;
/**
* @description whether show loading
* @default globalOptions.loading
*/
loading?: boolean;
/**
* @description whether log executed command
* @default globalOptions.logCommand
*/
logCommand?: boolean;
/**
* @description whether redirect all ctx.exec & ctx.spawn's output to file
* @default globalOptions.redirectLog
*/
redirectLog?: boolean | string | Writable;
}
/**
* Set global options for all tasks.
* @param options
*/
export declare function setGlobalOptions(options: GlobalOptions): void;
declare namespace TaskOptions {
let last: {
desc: string | undefined;
optionDefs: [string, string, OptionConfig | undefined][];
strict: boolean | undefined;
loading: boolean | undefined;
};
function empty(): {
desc: string | undefined;
optionDefs: [string, string, OptionConfig | undefined][];
strict: boolean | undefined;
loading: boolean | undefined;
};
}
export declare function desc(desc: string): void;
export declare function option(rawName: string, description: string, config?: OptionConfig): void;
export declare function strict(): void;
/**
* Set options for next task.
* @param options
*/
export declare function setOption(options: Partial): void;
export declare function task(name: string, fn: TaskFn): Task;
export declare function task(name: string, dependencies: Dependency[], fn?: TaskFn): Task;
export {};