Maintaining code generators over time can be a challenge in some cases. If you have a bug in the generator, you need to modify your templates, run the modified generator, and then manually import your changes back into the templates while remembering to replace keywords with ejs placeholders.
hygen-create offers an approach to creating new generators: take an existing piece of code and automatically transform it into a generator.
To create a generator using
- Start a
- Select files to include in the generator
- Specify a string to automatically turn into ejs snippets in the resulting templates
$ hygen-create generate
That's it! Your new
hygen generator is ready, and you can use it to create new "instances" of the code you generalized. If something's not right, you can fix the problem directly in the generated code, then run
hygen-create on the modified code to update the generator with your fix. It even remembers which files were originally included in the generator, so you don't have to select files all over again.
For more details see
- String variations (UPPERCASED, CamelCased, etc.) are automatically recognized. For example:
- Directory hierarchy is maintained
- Gradually add files to the generator in a git-like fashion
- Review auto-inserted ejs placeholders with a built-in colorized diff
- Iteratively author generators by running
hygen-createagain on the code created by the generator.