Setup
Generators are made of some CUE files and directories of templates.
You can run hof gen init <name>
to bootstrap a new generator module.
Bootstrapping Your Generator
Throughout the first example, you will be building a code generation module. The following commands will create a new directory, git repository, and hof generator for you to start with.
Your working directory should now look like this:
You will often have other files depending on the languages or technologies you choose.
A common example are the files for dependency management like package.json
and go.mod
.
There are no restrictions or limits on what you can include.
The default directories:
schema
is where your schemas for the other parts gogen
holds CUE files for specifying your generatorstemplates
,partials
, andstatics
are files for generatorscreators
are often in a subdirectory with their own templatesexamples
for using your generators, also helpful for testing