.verb.md
August 4, 2018 ยท View on GitHub
Usage
// Create an instance of `Composer`
const Composer = require('{%= name %}');
const composer = new Composer();
// Define tasks with the .task() method
composer.task('foo', callback => {
callback(); // do stuff
});
composer.task('bar', callback => {
callback(); // do stuff
});
composer.task('baz', ['foo'. 'bar']);
// Run tasks with the .build() method
composer.build('baz')
.then(() => console.log('done!'))
.catch(console.error);
API
Tasks
{%= apidocs("lib/tasks.js") %}
Generators
{%= apidocs("lib/generator.js") %}
Events
task
app.on('task', function(task) {
switch (task.status) {
case 'starting':
// Task is running
break;
case 'finished':
// Task is finished running
break;
}
});
task-pending
Emitted after a task is registered.
task-preparing
Emitted when a task is preparing to run, right before it's called. You can use this event to dynamically skip tasks by updating task.skip to true or a function.
Release history
See the changelog.