Interface Template

Interface defining a template that can be generated using the TemplateDirective.

Hierarchy

  • Template

Properties

baseAppPath: string[]

Array of path-strings that are resolved relative to the base app directory.

Example

['http', 'controllers']

Example

['units']

description: string

Brief description of the template displayed on the --help page for the TemplateDirective. Should be brief (1 sentence).

fileSuffix: string

The suffix of the file generated by this template.

Example

.mytemplate.ts

Example

.controller.ts

name: string

The name of the template as it will be specified from the command line.

Example

If this is 'mytemplate', then the template will be created with:

./ex new mytemplate some:path
render: ((name: string, fullCanonicalName: string, targetFilePath: UniversalPath) => string | Promise<string>)

Type declaration

    • (name: string, fullCanonicalName: string, targetFilePath: UniversalPath): string | Promise<string>
    • Render the given template to a string which will be written to the file. Note: this method should NOT write the contents to targetFilePath.

      Example

      If the user enters:

      ./ex new mytemplate path:to:NewInstance
      

      Then, the following params are:

      {
      name: 'NewInstance',
      fullCanonicalPath: 'path:to:NewInstance',
      targetFilePath: UniversalPath { }
      }

      Parameters

      • name: string

        the singular name of the resource

      • fullCanonicalName: string

        the full canonical name of the resource

      • targetFilePath: UniversalPath

        the UniversalPath where the file will be written

      Returns string | Promise<string>