Git Product home page Git Product logo

denwa-do's Introduction

@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

denwa-do's People

Contributors

juanka881 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.