@denwa/do
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@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.

GitHub Workflow Status npm (scoped)

Installation

npm install @denwa/do

Usage

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): void

task

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>): void

execute

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

Package Sidebar

Install

npm i @denwa/do

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

10.9 kB

Total Files

11

Last publish

Collaborators

  • juankab