Uses prompt-confirm to conditionally run composer tasks based on responses to prompts. Can also be used with assemble, generate, verb and update (instead of composer).
Install with npm:
$ npm install --save composer-confirm
var Composer = require('composer');
var composer = new Composer();
// pass an instance of composer and optional fn
// if `fn` is passed it will be called with the prompt
// instance before running the prompt
var confirm = require('composer-confirm')(composer, fn);
confirm(taskName, message, yesCallback, noCallback);
Callbacks for yes and no can be any valid argument to a composer task.
Functions
confirm('default', 'Want to run this?', function(cb) {
console.log('YES!!! :)');
cb();
}, function(cb) {
console.log('NO?!! :(');
cb();
});
No-op
Simulate a no-op task by passing an empty array.
confirm('default', 'Want to run this?', [], function(cb) {
console.log('NO?!! :(');
cb();
});
Task names
app.task('yes', function(cb) {
console.log('YES!!! :)');
cb();
})
app.task('no', function(cb) {
console.log('NO?!! :(');
cb();
})
confirm('default', 'Want to run this?', 'yes', 'no');
Arrays of task names
app.task('yes', function(cb) {
console.log('YES!!! :)');
cb();
});
app.task('and', function(cb) {
cb();
})
app.task('no', function(cb) {
console.log('NO?!! :(');
cb();
});
app.task('but', function(cb) {
cb();
});
confirm('default', 'Want to run this?', ['yes', 'and'], ['no', 'but']);
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running 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:
$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on June 02, 2017.