This workspace allows you to easilly create yeoman generators written in TypeScript.
.vscode
This folder contains settings and build-task configurations for VSCode.src
This is where you program your module in TypeScript.
The TypeScript-Compiler is configured to use this folder as the root of your source-code.src/generatorsThis folder holds the generators written in TypeScript.
lib
Thelib-folder is the one where your compiled.js-files are written to.tsconfig.json
This is the file where the compiler-options are configured.
Learn more...tslint.jsonThis file mostly holds rules for your coding-style.
Learn more...
You can create the main generator by creating a directory called app
or a sub-generator by creating a directory called { sub-generator-name }
inside the src/generators-directory.
Create a generator by creating an index.ts-file inside said directory
and let it derive from the Generator class located in the src/Generator.ts file.
Use the IntelliSense of your TypeScript-editor for getting more information about the different useful class members.
- The
TemplateRoot-member allows you to specify a path to the templates relative to thetemplates/-directory - The
ProvidedComponents-member allows you to specify components users can optionally choose to install - The
Questions-member contains questions users are prompted to answer during the execution ofGenerator.prompting()
You can test the generator in Visual Studio Code
by running the Launch Yeoman-Debug configuration.
This project also supports Unit-Tests using mocha.
You can run them using the Launch Tests-configuration.
First you need to create a symbolic link of
your project in the global node_modules-directory.
You can do this by invoking following command:
npm linkThis can be undone using its counterpart:
npm unlinkBefore you can use your generator
you must transpile the TypeScript-code to JavaScript.
Doing this is as simple as:
npm run buildOr - if you want to clean the output-directory before transpiling the code:
npm run rebuildYou can then run your generator by invoking either one of these commands:
yo gjsify
yo gjsify:example