A simple coverage handler and server.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
600 B

import handlebars from "handlebars";
import fs from "fs";
export interface Template {
inputFile: string;
outputFile: string;
context: object;
data: string | undefined;
export default (_template: Template): Promise<Template> =>
.readFile(_template.inputFile, "utf-8")
.then(buffer => {
const translate = handlebars.compile(buffer);
return {
data: translate(_template.context)
.then(template =>
.writeFile(template.outputFile, template.data)
.then(() => template)