An open API service indexing awesome lists of open source software.

https://github.com/twocaretcat/NoBS

A dead simple build task runner for Node.js
https://github.com/twocaretcat/NoBS

build-automation build-tool javascript node-module nodejs task-runner task-scheduler

Last synced: about 1 month ago
JSON representation

A dead simple build task runner for Node.js

Awesome Lists containing this project

README

          


NoBS - Node Build Script


Project category
Language
Repository size

Project license




No Maintenance Intended

Experimental


A dead simple build task runner for Node.js.



> [!IMPORTANT]
> I've marked this project as [UNMAINTAINED](https://unmaintained.tech/) because it hasn't seen an update in a while. You can still fork/download/use this project at your own risk, but I won't be able to provide support or updates.

> [!WARNING]
> This is currently an experimental project or proof-of-concept. It may contain bugs or incomplete features, and is not intended for production use. Breaking changes may be made at any time. I would recommend [Gulp] as a more powerful, fleshed out alternative.

## ๐Ÿ‘‹ About
Automate your build process by scheduling build tasks to be run either sequentially or concurrently using a simple array-based config object.

## ๐Ÿ“ฆ Installation
Install with `npm install git+https://github.com/twocaretcat/NoBS.git` for the latest version. The project is not on NPM at this time.

## ๐Ÿ•น๏ธ Usage

1. Import the module with:
```Javascript
const NoBS = require('NoBS');
```

2. Create an array of tasks:
```Javascript
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.

3. (Optional) Define additional options:
```Javascript
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 task
- `result/error`: The value passed to `resolve()` or `reject()` when a task finishes. Since you write the task functions, this can be whatever you want
- `stageHasError`: 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.

3. Create a NoBS object with:
```Javascript
const noBS = new NoBS(taskList, options);
```

Note that `options` is not required here.

4. Run tasks with NoBS:
```Javascript
noBS.run()
.then(result => console.log('Done'))
.catch(error => console.error(`Error: ${error}`));
```

---

Please see [test.js](test.js) for a complete example.

## ๐Ÿค Contributing
This is an experimental project but input is welcome :).

## ๐Ÿงพ License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.

## ๐Ÿ–‡๏ธ Related
**[Gulp]**: A toolkit to automate & enhance your workflow. Write individual, focused tasks and compose them into larger operations, providing you with speed and accuracy while reducing repetition.

## ๐Ÿ’• Funding

Find this project useful? [Sponsoring me](https://johng.io/funding) will help me cover costs and **_commit_** more time to open-source.

If you can't donate but still want to contribute, don't worry. There are many other ways to help out, like:

- ๐Ÿ“ข reporting (submitting feature requests & bug reports)
- ๐Ÿ‘จโ€๐Ÿ’ป coding (implementing features & fixing bugs)
- ๐Ÿ“ writing (documenting & translating)
- ๐Ÿ’ฌ spreading the word
- โญ starring the project

I appreciate the support!

[Gulp]: https://gulpjs.com/