import {UniversalPath} from '../util' /** * Interface defining a template that can be generated using the TemplateDirective. */ export interface Template { /** * 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: * * ```shell * ./ex new mytemplate some:path * ``` */ name: string, /** * The suffix of the file generated by this template. * @example `.mytemplate.ts` * @example `.controller.ts` */ fileSuffix: string, /** * Brief description of the template displayed on the --help page for the TemplateDirective. * Should be brief (1 sentence). */ description: string, /** * Array of path-strings that are resolved relative to the base `app` directory. * @example `['http', 'controllers']` * @example `['units']` */ baseAppPath: 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: * * ```shell * ./ex new mytemplate path:to:NewInstance * ``` * * Then, the following params are: * ```typescript * { * name: 'NewInstance', * fullCanonicalPath: 'path:to:NewInstance', * targetFilePath: UniversalPath { } * } * ``` * * @param name - the singular name of the resource * @param fullCanonicalName - the full canonical name of the resource * @param targetFilePath - the UniversalPath where the file will be written */ render: (name: string, fullCanonicalName: string, targetFilePath: UniversalPath) => string | Promise }