HofGenerator is the schema for generators.
As a creator, this is the definition you will use
to define how an input is combined with templates
to produce the output files.
As a user, you will supply the input values
to a specific geneartor to create code.
These are fields that a user of a generator will typically fill in. The following fields are the default suggested user inputs You can decided to ignore these fields and make any set of exposed input fields for your generators.
This is the primary input for users and will be used when rendering the templates. (need to check if this is provided as a root context on repeated templates, or if that is set by creators, or is it the default applied when no input is set on a per template basis)
As a creator, you will likely want to provide a schema and set
This will make it easier for users to know if they have correctly specified
the required input.
This is the base dir where the generator output will be written.
#HofGenerator was left open so you can
specify an other inputs for your users.
This is the primary field processed by
Your generator should fill in this field based on the user input.
Each element will have both input and a template specified.
This is where the conditional logic for what to generate comes in.
More details can be found in the next section.
NamedTemplates, NamedPartials, StaticFiles
These are maps of
filename -> content pairs.
This is the CUE module name of your generator.
It is used for indexing into the
to find your templates and partials from disk.
(this will go away once CUE supports the @embed() for this purpose)
These are each a directory to find and load templates from. Filenames will be relative to the value.
These are file glob patterns which should be copied directly over into the output.
These are the configurations for the template rendering process.
This is where you set sub-generators that your generator builds on. We have used this for
- Using one generator in another, for example to provide a more advanced CLI for our REST server binary.
- Building higher level generators, for example an APP which has Client, Server, and Database subgenerators with a single input.