@tsdi/pack
Version:
@tsdi/pack is simple build tasks, base on AOP, Ioc container, via @tsdi. dev build pack activities.
102 lines (101 loc) • 2.84 kB
TypeScript
/// <reference types="node" />
import { ExecOptions } from 'child_process';
import { ObjectMap } from '@tsdi/ioc';
import { Binding } from '@tsdi/components';
import { Src, TemplateOption } from '@tsdi/activities';
import { NodeActivityContext, NodeExpression } from '../NodeActivityContext';
import { NodeActivity } from '../NodeActivity';
/**
* shell activity config.
*
* @export
* @interface ShellActivityConfig
* @extends {ActivityConfigure}
*/
export interface ShellActivityOption extends TemplateOption {
/**
* shell cmd
*
* @type {Binding<NodeExpression<Src>>}
* @memberof ShellActivityConfig
*/
shell?: Binding<NodeExpression<Src>>;
/**
* shell args.
*
* @type {Binding<NodeExpression<string[] | ObjectMap>>}
* @memberof ShellActivityConfig
*/
args?: Binding<NodeExpression<string[] | ObjectMap>>;
/**
* shell exec options.
*
* @type {Binding<NodeExpression<ExecOptions>>}
* @memberof ShellActivityConfig
*/
options?: Binding<NodeExpression<ExecOptions>>;
/**
* allow error or not.
*
* @type {Binding<NodeExpression<boolean>>}
* @memberof ShellActivityConfig
*/
allowError?: Binding<NodeExpression<boolean>>;
/**
* run shell in parallel.
*
* @type {Binding<NodeExpression<boolean>>}
* @memberof ShellActivityOption
*/
parallel?: Binding<boolean>;
}
/**
* Shell Task
*
* @class ShellActivity
* @implements {ITask}
*/
export declare class ShellActivity extends NodeActivity<void> {
/**
* shell cmd.
*
* @type {Src}
* @memberof ShellActivity
*/
shell: NodeExpression<Src>;
/**
* shell args.
*
* @type {string[]}
* @memberof ShellActivity
*/
args: NodeExpression<string[] | ObjectMap>;
/**
* shell exec options.
*
* @type {CtxType<ExecOptions>}
* @memberof ShellActivity
*/
options: NodeExpression<ExecOptions>;
/**
* allow error or not.
*
* @memberof ShellActivity
*/
allowError: NodeExpression<boolean>;
/**
* execute shells in parallel.
*
* @type {NodeExpression<boolean>}
* @memberof ShellActivity
*/
parallel: boolean;
execute(ctx: NodeActivityContext): Promise<void>;
protected formatShell(shell: string, args: string[]): string;
protected formatArgs(args: ObjectMap): string[];
protected formatArg(arg: any, key: string, args?: ObjectMap): string;
protected execShell(cmd: string, args: string[], options?: ExecOptions, allowError?: boolean): Promise<any>;
protected checkStderr(err: string | Buffer, reject: Function, allowError: boolean): void;
protected checkStdout(data: string | Buffer, resolve: Function, reject: Function): void;
static ρAnn(): any;
}