A dead simple build task runner for Node.js.
Automate your build process by scheduling build tasks to be run either sequentially or concurrently using a simple array-based config object.
This is an experimental project and there are likely a lot of bugs to be ironed out. I would recommend Gulp as a more powerful, fleshed out alternative
Install with npm install git+https://github.com/jerboa88/NoBS.git
for the latest version. The project is not on NPM at this time.
- Import the module with:
const NoBS = require('NoBS');
- Create an array of tasks:
const taskList = [
[taskA1, taskA2],
[taskB1],
[taskC1, taskC2, taskC3]
];
Tasks are simply functions which return a promise. Tasks are contained in stages, which are the sub-arrays shown here. Every task in a stage will be started at the same time, and once all tasks in a stage are complete, the next stage will start. Note that this cannot be nested any further.
- (Optional) Define additional options:
const options = {
taskSuccessCallback: taskSuccessCallback,
taskErrorCallback: taskErrorCallback,
debug: true
}
Any of these properties can be left out if not required.
taskSuccessCallback
and taskErrorCallback
are callback functions that are fired each time a task completes or fails, respectively. They should each accept three arguments:
taskName
: The function name of a taskresult/error
: The value passed toresolve()
orreject()
when a task finishes. Since you write the task functions, this can be whatever you wantstageHasError
: Whether an error has been encountered while running any tasks in this stage. We will wait for all tasks in a stage to complete even if there is an error, so this can be used to filter out duplicate error messages, for example
debug
controls whether debug messages are printed to the console.
- Create a NoBS object with:
const noBS = new NoBS(taskList, options);
Note that options
is not required here.
- Run tasks with NoBS:
noBS.run()
.then(result => console.log('Done'))
.catch(error => console.error(`Error: ${error}`));
Please see test.js for a complete example.
This is an experimental project but input is welcome :). SemVer is used for versioning.
This project is licensed under the MIT License. See LICENSE for details.