https://github.com/jamen/pull-task
A task system for pull-streams
https://github.com/jamen/pull-task
Last synced: 10 months ago
JSON representation
A task system for pull-streams
- Host: GitHub
- URL: https://github.com/jamen/pull-task
- Owner: jamen
- License: mit
- Created: 2017-01-19T01:08:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-19T01:22:46.000Z (over 9 years ago)
- Last Synced: 2024-04-25T18:02:37.336Z (about 2 years ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# pull-task
> A task system for pull-streams
## Installation
```sh
$ npm install --save pull-task
```
## Usage
### `task(name, [deps], [stream])`
Create a task that runs the stream after running any tasks it depends on.
- `name` (`String`): Name of the task.
- `deps` (`Array`): Tasks to execute before.
- `stream` (`Array`): A pull-stream chain associated with the task.
```js
// Normal task:
task('foo', [
vinyl.read('./**/*.js'),
// ...
vinyl.write('out')
])
// Task with dependencies:
task('bar', ['foo'], [
// ...
])
// A wrapping task:
task('qux', ['foo', 'bar'])
```
### `task.run(name, [done])`
Run a task and any dependency tasks it has.
- `name` (`String`): A name (or array of names) of the task to run.
- `done` (`Function`): A completion callback. Receives `(err, task || tasks)`
```js
task.run('foo', function (err, task) {
// ...
})
task.run(['foo', 'bar', 'qux'], function (err, tasks) {
// ...
})
```
## License
MIT © [Jamen Marz](https://git.io/jamen)
---
[][package] [](https://travis-ci.org/jamen/pull-task) [][package] [][package] [](https://paypal.me/jamenmarz/5usd) [](https://github.com/jamen)
[package]: https://npmjs.org/package/pull-task