{"name":"base-task","description":"Base plugin that provides a very thin wrapper around <https://github.com/doowb/composer> for adding task methods to your Base application.","version":"2.0.1","homepage":"https://github.com/base/base-task","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"contributors":[{"name":"Brian Woodward","url":"https://twitter.com/doowb"},{"name":"Dave Quick","url":"http://dq.gg"},{"name":"Jon Schlinkert","url":"http://twitter.com/jonschlinkert"}],"repository":{"type":"git","url":"git+https://github.com/base/base-task.git"},"bugs":{"url":"https://github.com/base/base-task/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=8"},"scripts":{"test":"mocha"},"dependencies":{"composer":"^2.0.2","define-property":"^2.0.2"},"devDependencies":{"base":"^3.0.0","gulp-format-md":"^1.0.0","mocha":"^3.5.3"},"keywords":["api","app","application","base","base-plugin","baseplugin","build","building-blocks","composer","control","create","flow","framework","generate","plugin","plugins","run","task","tasks","tool","toolkit","tools"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"description":"Other base plugins you might be interested in:","list":["base","base-cli","base-generators","base-option","base-plugins","base-store"]},"reflinks":["base-watch","composer"]},"gitHead":"ba9cccda766bfffc203ee02a8648f308ce5fed92","_id":"base-task@2.0.1","_npmVersion":"5.8.0","_nodeVersion":"9.9.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"integrity":"sha512-T3oBDSCVOPCG/W5Fgf+H69J6tvJhRWi+UU8fTZXYjdc7ZcyYe7UAIok+uK1CYOqVohnrA8+dpUT1SWuusKwbWg==","shasum":"6894a8ae39f0e0cf92a53e38e786e330e3b64bf1","tarball":"http://registry-npm.ywwl.com/base-task/download/base-task-2.0.1.tgz","fileCount":4,"unpackedSize":12501,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjyflnxiZM1Awz6ZkTml+hKnZlEIqlf3G9F/dYu+FfJgIgL091t0roWbyst4PNXfh/CUEj0x1BqcfElrG8oF6bxeQ="}],"size":4175,"noattachment":false,"key":"/base-task/-/base-task-2.0.1.tgz"},"maintainers":[{"email":"brian.woodward@gmail.com","name":"doowb"},{"email":"github@sellside.com","name":"jonschlinkert"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/base-task_2.0.1_1522379634800_0.6802149033355824"},"_hasShrinkwrap":false,"readme":"# base-task [![NPM version](https://img.shields.io/npm/v/base-task.svg?style=flat)](https://www.npmjs.com/package/base-task) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-task.svg?style=flat)](https://npmjs.org/package/base-task) [![NPM total downloads](https://img.shields.io/npm/dt/base-task.svg?style=flat)](https://npmjs.org/package/base-task) [![Linux Build Status](https://img.shields.io/travis/base/base-task.svg?style=flat&label=Travis)](https://travis-ci.org/base/base-task)\n\n> Base plugin that provides a very thin wrapper around [https://github.com/doowb/composer](https://github.com/doowb/composer) for adding task methods to your Base application.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save base-task\n```\n\n## Usage\n\n```js\nconst Base = require('base');\nconst tasks = require('base-task');\nconst base = new Base();\n\nbase.use(tasks());\n\n/**\n * Define tasks\n */\n\nbase.task('foo', cb => {\n  console.log('this is foo!');\n  cb();\n});\n\nbase.task('bar', cb => {\n  console.log('this is bar!');\n  cb();\n});\n\n/**\n * Build tasks\n */\n\nbase.build(['foo', 'bar'])\n  .then(() => {\n    // this is foo!\n    // this is bar!\n    console.log('done!');\n  })\n  .catch(console.error)\n```\n\nSee the [composer](https://github.com/doowb/composer) documentation for more details, or to create bug reports related to running or registering tasks.\n\n## API\n\n### .task\n\nRegister a task\n\n**Params**\n\n* `name` **{String}**: Task name to register (tasks are cached on `app.tasks`)\n* `dependencies` **{String|Array|Function}**: String, list or array of tasks.\n* `callback` **{Function}**: Function to be called when the task is executed. Task functions should either return a stream or call the callback to let [composer](https://github.com/doowb/composer) know when the task is finished.\n\n**Examples**\n\nRegister a task.\n\n```js\napp.task('default', function() {\n  // return the stream to signal \"done\"\n  return app.src('pages/*.hbs')\n    .pipe(app.dest('dist'));\n});\n```\n\nRegister a task with dependencies (other tasks to run before executing the task):\n\n```js\napp.task('site', ['styles'], function() {\n  return app.src('pages/*.hbs')\n    .pipe(app.dest('dist'));\n});\n\napp.task('default', ['site']);\n```\n\n**Get a task**\n\n```js\nconst task = app.task('site');\n```\n\n### .build\n\nRun a task or array of tasks.\n\n**Promise examples**\n\n```js\n// run the \"default\" task, if defined\napp.build();\napp.build('default');\n\n// run an array of tasks\napp.build(['foo', 'bar'])\n  .then(() => console.log('done!'))\n  .catch(console.error);\n```\n\n**Callback examples**\n\n```js\n// run the \"default\" task, if defined\napp.build(function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n});\n\napp.build('default', function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n});\n\napp.build(['foo', 'bar'], function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n});\n```\n\n### .series\n\nCompose task or list of tasks into a single function that runs the tasks in series.\n\n**Params**\n\n* `tasks` **{String|Array|Function}**: List of tasks by name, function, or array of names/functions.\n* `returns` **{Function}**: Composed function that may take a callback function.\n\n**Example**\n\n```js\napp.task('foo', cb => {\n  console.log('this is foo');\n  cb();\n});\n\nconst build = app.series('foo', cb => {\n  console.log('this is bar');\n  cb();\n});\n\nbuild(function(err) {\n  if (err) return console.error(err);\n  console.log('finished');\n});\n//=> this is foo\n//=> this is bar\n//=> finished\n```\n\n### .parallel\n\nCompose task or list of tasks into a single function that runs the tasks in parallel.\n\n**Params**\n\n* `tasks` **{String|Array|Function}**: List of tasks by name, function, or array of names/functions.\n* `returns` **{Function}**: Composed function that may take a callback function.\n\n**Example**\n\n```js\napp.task('foo', cb => {\n  setTimeout(function() {\n    console.log('this is foo');\n    cb();\n  }, 500);\n});\n\nconst build = app.parallel('foo', cb => {\n  console.log('this is bar');\n  cb();\n});\n\nbuild(function(err) {\n  if (err) return console.error(err);\n  console.log('finished');\n});\n//=> this is bar\n//=> this is foo\n//=> finished\n```\n\n## Events\n\nThe following events are emitted by [composer](https://github.com/doowb/composer). See the composer docs for more details\n\n### on.task\n\nEmitted when a `task` is `register`, `starting` and `finished`.\n\n```js\napp.on('task', function(task) {\n  console.log(task.status);\n  //=> 'register'\n});\n```\n\n### on.build\n\nEmitted when a `build` is `starting` and `finished`.\n\n```js\napp.on('build', function(build) {\n  console.log(build.status);\n  //=> 'starting'\n});\n```\n\n## History\n\n### v2.0.0\n\n* Bumped [composer](https://github.com/doowb/composer) to v2.0.0.\n\n### v0.3.0\n\n* Bumped [composer](https://github.com/doowb/composer) to v0.11.0, so the `.watch` method is no longer included by default. To add `.watch`, use the [base-watch](https://github.com/node-base/base-watch) plugin.\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nOther base plugins you might be interested in:\n\n* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://github.com/node-base/base-cli) | [homepage](https://github.com/node-base/base-cli \"Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a few plugins, like 'base-store', 'base-options' and 'base-data'.\")\n* [base-generators](https://www.npmjs.com/package/base-generators): Adds project-generator support to your `base` application. | [homepage](https://github.com/node-base/base-generators \"Adds project-generator support to your `base` application.\")\n* [base-option](https://www.npmjs.com/package/base-option): Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme… [more](https://github.com/node-base/base-option) | [homepage](https://github.com/node-base/base-option \"Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.\")\n* [base-plugins](https://www.npmjs.com/package/base-plugins): Adds 'smart plugin' support to your base application. | [homepage](https://github.com/node-base/base-plugins \"Adds 'smart plugin' support to your base application.\")\n* [base-store](https://www.npmjs.com/package/base-store): Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object… [more](https://github.com/node-base/base-store) | [homepage](https://github.com/node-base/base-store \"Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object that exposes all of the methods from the data-store library. Also now supports sub-stores!\")\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 60 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 6  | [doowb](https://github.com/doowb) |  \n| 2  | [davequick](https://github.com/davequick) |  \n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on November 22, 2018._\n","publish_time":1522379634885,"_cnpm_publish_time":1522379634885,"dist-tags":{"latest":"3.0.0"}}