yeoman-prompting-helpers
v1.2.7
Published
share prompting answers with other generators
Downloads
3
Maintainers
Readme
yeoman-prompting-helpers
share prompting answers with other generators
table of contents
installation
within the generator project directory
npm install yeoman-prompting-helpers
use
initializing
in the generator’s initializing method
var PromptAnswers = require( 'yeoman-prompting-helpers' ).PromptAnswers;
this.options.PromptAnswers = this.options.PromptAnswers || new PromptAnswers();
this.composeWith(
'your-generator',
{ options: { PromptAnswers: this.options.PromptAnswers } },
{ local: require.resolve( 'generator-your-generator' ) }
);
prompting
in the generator’s prompting method use the promptingHelper
var promptingHelper = require( 'yeoman-prompting-helpers' ).promptingHelper;
/**
* @returns {Array}
*/
function getGeneratorPrompts() {
return [
// your generator’s prompts
];
}
return promptingHelper( this, getGeneratorPrompts() );
using prompt answers
anywhere the generator needs to retrieve a prompt answer
this.options.PromptAnswers.get( prompt.name )
example project
generator-node-module illustrates how to initially setup the helpers and generator-license shows how to use the shared prompt answers