IF Commons GitHub

templates/data

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-host FR-003

What a template is given and what it is (commons 0003-host FR-003): a template is a TypeScript function from the decoded data to a list of generated files, and not text in a template language, so that the compiler checks it and no value of the data can become code. TemplateData is the manifest and the two facts a probe gave; Template names its generator, which the header of each of its files says.

Source: commons/ergonex/src/templates/data.ts

1 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Templatetypeno test imports it
type Template = {
  readonly name: string;
  readonly render: (data: TemplateData) => Result<readonly GeneratedFile[], readonly GenerateError[]>;
};

A template: its generator's name and what it makes.

TemplateDatatype
type TemplateData = {
  readonly manifest: Manifest;
  /** The manifest says `direnv` is wanted and a probe found it. */
  readonly direnv: boolean;
  readonly tools: readonly ToolEntry[];
};

What the templates read: the decoded manifest, whether direnv is wanted and found (0003-host FR-023), and the resolved tool catalog (the manifest's, empty where it names none).

Imported by 10 tests of the run (10 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.