@denwa/do
v1.1.0
Published
Javascript based task runner. build and run tasks with javascript in the same spirit as [Jake](https://www.npmjs.com/package/jake), [Grunt](https://www.npmjs.com/package/grunt).
Maintainers
Readme
@denwa/do
Javascript based task runner. build and run tasks with javascript in the same spirit as Jake, Grunt.
Use when package.json scripts becomes too scary.
Installation
npm install @denwa/doUsage
create a do.js file in project repo root.
// import functions
let { sh, task, execute } = require('@denwa/do');
// register hello task
task('hello', () => {
sh('echo hello friend!');
});
// parse arguments and execute tasks
execute();execute hello task with following command
$ node do hello
hello friend!API
sh
execute a shell command, works the same as child_process.execSync except that it catches an exit code of 130 and exits the current process.
function sh(command: string | string[], options: ExecSyncOptions): voidtask
register a task callback to be executed, the callback can be sync or async
and takes a minimist ParsedArgs object
function task(name: string, callback: (args?: ParsedArgs) => void | Promise<void>): voidexecute
executes the tasks register by parsing the command line arguments and invoking the requested task names
async function execute(args?: string[]): Promise<number>Command Line
node <script> <tasks> <options?>where
| Parameter | Description |
| --------- | -------------------------------------------------------------- |
| script | name of script file to execute, see do.js example in Usage |
| tasks | one of more space separate task names to execute |
| options | task specific options |
