The presence of a codegenconfig.json file in a directory indicates that the directory is the root of a code generation project. The codegenconfig.json indicates which templates to run when the yellicode command is invoked in that directory.

For each template, a model can be configured as input.


  "templates": [
      "templateFile": "./entities.template.ts",
      "modelFile": "my-code-model",
      "debug": true,
      "templateFile": "./viewmodels.template.ts",
      "modelFile": "my-code-model"
      "templateFile": "./bootstrap.template.ts",
      "modelFile": "my-code-model",
      "outputMode": "once"
  "compileTypeScript": true

Per-template configuration


The templateFile property is required and contains the path to the TypeScript or javascript file that contains the template.


The modelFile property is optional and contains the path to the Yellicode model (.ymn file) to use for the template. The file extension can be omitted. The template receives an instance of the model as follows:

import * as elements from '@yellicode/elements';
import { Generator, TextWriter } from '@yellicode/templating';

Generator.generateFromModel({ outputFile: './Entities.cs' }, (textWriter: TextWriter, model: elements.Model) => {
    // Code generation code goes here, using the model API

You can create a template that does not use a Yellicode model as follows:

import { Generator, TextWriter } from '@yellicode/templating';

Generator.generate({outputFile: './simple-file.txt'}, (writer: TextWriter) => {
    // Code generation code goes here


The templateArgs field can contain custom JSON data that you want to pass to the template. In the template, you can access this data using the Generator.templateArgs field. See Passing Arguments to a Template for more information.


A special flag used for template debugging. The first template with debug set to true will be the debug target. For details, see Template debugging.


Indicates when and how output files should be updated. One of the following values is allowed:

  • overwrite - The output file will be truncated if it exists. This is the default if outputMode is omitted.
  • once - The output file will not be truncated if it already exists. Use this option if you want to update the file manually once it is generated.
  • append - The template output will be appended to the file if it already exists. The file is created if it does not exist.

If you need finer grained control, you can override the output mode in your code generation template. Please refer to CodeGenerationOptions in the templating API for more information.


Set disable to true if you want to (temporarilly) skip running a specific template.

Note: all paths must be relative to the codegenconfig.json file.

Global configuration


When compileTypeScript is true, Yellicode will compile all configured templates that have a .ts extension. Set this value to false if you need more control over TypeScript compilation. For details, see Controlling TypeScript compilation.


The typeScriptConfigFile property allows you to use a custom tsconfig.json file. For details, see Controlling TypeScript compilation.