An extended version of the Yeoman-Generator
ExtendedYoGenerator can be installed using the
npm install --save extended-yo-generator
You can use the extended yo-generator by inheriting the
Generator-class provided by the module.
All class members are documented using js-doc in order to provide the best possible user-experience.
First you might want to create an interface describing the settings of your generator where the prompting-answers are stored.
Now you're ready to create the actual generator-class:
- Separate Template-Folders
- Yo-Generator Methods
Generally all templates are loaded from
TemplateRoot-member of the
Generator-class allows you to load template-files from separate sub-folders of
this.templatePath(...path) to create paths relative to
./templates/app rather than
You can provide components the user can choose to install.
Each component can provide any number of file-mappings and additional questions.
The generator asks what components to install.
If there are any questions declared for the component the generator will automatically ask them if the component has been checked.
The IDs of the components the user has chosen are then written to the
Specify questions which are asked when invoking
All answers are stored in the
You might want to ask questions after the user has chosen components.
You can reach this goal by manipulating the
QuestionCollection-property like this:
Generator.Settings-property contains all answers to the prompts.
Generator.modulePath(...path)-method you can create paths relative to the root of your generator-module.
This may be useful for instance if you want to copy your
tslint-rules to the generated workspace:
Generator.prompting()-method asks all questions specified using
Generator.writing()-method copies all
FileMappings of the components.
Naturally the default yo-generator methods remain which are…
Questionsand additionally all questions related to the
Generates the project, automatically creating all specified file-mappings of the
This method can be used for installing the generated project
This method is invoked after the generator finished running