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
- Host: GitHub
- URL: https://github.com/twocaretcat/NoBS
- Owner: jerboa88
- License: mit
- Created: 2021-12-29T22:57:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T04:26:46.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T22:01:35.488Z (about 1 year ago)
- Topics: build-automation, build-tool, javascript, node-module, nodejs, task-runner, task-scheduler
- Language: JavaScript
- Homepage: https://johng.io/p/no-bs
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!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/