All files / lib registerTemplates.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 232x   2x 2x                     2x   1x       1x    
import * as Handlebars from 'handlebars/runtime';
 
import enums from '../templates/enums.hbs';
import permission from '../templates/permission.hbs';
 
export interface Templates {
  enums: Handlebars.TemplateDelegate;
  permission: Handlebars.TemplateDelegate;
}
 
/**
 * Read all the Handlebar templates that we need and return on wrapper object
 * so we can easily access the templates in out generator / write functions.
 */
export function registerHandlebarTemplates(): Templates {
  // Main templates (entry points for the files we write to disk)
  const templates: Templates = {
    enums: Handlebars.template(enums),
    permission: Handlebars.template(permission),
  };
  return templates;
}