madoos-yo-helper
Allows abstract writing of templates for yeoman generators.
Features
- Add the directory tree that is inside templates
- Gets the prompt vars and passes them as arguments to the templates
Considerations
- Transforms all files with
_
in their name to.
, for example_gitignore
to.gitignore
Functions
.prompts
.fileWriter
Getting Started
To install:
npm i --save madoos-yo-helper
In the generator index:
const yeoman = ;const generatorName = 'some-generator-name';const questions = type: 'input' name: 'name'message: 'Your project name'default: null;const templatePath = ;// require moduleconst yoHelper = generatorName questions templatePath;moduleexports = yeomanBase;
If you want to use the yeoman context to get props:
const yeoman = ;const generatorName = 'some-generator-name';// Now questions is a function that allows to obtain the context of yeomanconst questions = {const moduleName = type: 'input' name: 'name'message: 'Your project name'default: thisappnamereturn moduleName;};const templatePath = ;// require moduleconst yoHelper = generatorName questions templatePath;moduleexports = yeomanBase;