Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/composer-confirm
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).
https://github.com/jonschlinkert/composer-confirm
build composer enquirer plugin prompt task
Last synced: 21 days ago
JSON representation
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).
- Host: GitHub
- URL: https://github.com/jonschlinkert/composer-confirm
- Owner: jonschlinkert
- License: mit
- Created: 2017-06-02T10:06:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-02T10:36:43.000Z (over 7 years ago)
- Last Synced: 2024-11-25T03:30:11.610Z (about 1 month ago)
- Topics: build, composer, enquirer, plugin, prompt, task
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 22.5 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# composer-confirm [![NPM version](https://img.shields.io/npm/v/composer-confirm.svg?style=flat)](https://www.npmjs.com/package/composer-confirm) [![NPM monthly downloads](https://img.shields.io/npm/dm/composer-confirm.svg?style=flat)](https://npmjs.org/package/composer-confirm) [![NPM total downloads](https://img.shields.io/npm/dt/composer-confirm.svg?style=flat)](https://npmjs.org/package/composer-confirm) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/composer-confirm.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/composer-confirm)
> Uses [prompt-confirm](https://github.com/enquirer/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
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save composer-confirm
```## Usage
```js
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);
```## Examples
Callbacks for `yes` and `no` can be any valid argument to a [composer](https://github.com/doowb/composer) task.
**Functions**
```js
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.
```js
confirm('default', 'Want to run this?', [], function(cb) {
console.log('NO?!! :(');
cb();
});
```**Task names**
```js
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**
```js
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']);
```## About
### Related projects
* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
* [enquirer](https://www.npmjs.com/package/enquirer): Intuitive, plugin-based prompt system for node.js. | [homepage](http://enquirer.io "Intuitive, plugin-based prompt system for node.js.")
* [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate "Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.")
* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.")
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
### Building docs
_(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.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Running tests
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:
```sh
$ npm install && npm test
```### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._