Skip to content

Commit 9653d86

Browse files
committed
fix: add partial support for mustache templates back
1 parent 853a7ec commit 9653d86

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/mustache.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ValidateInput } from "code-skeleton/lib/generators/abstract";
12
import { Generator } from "code-skeleton/lib/generators/abstract";
23
import { readFile } from "node:fs/promises";
34
import Mustache from "mustache";
@@ -25,6 +26,18 @@ class MustacheGenerator extends Generator<MustacheGeneratorOptions> {
2526
const rendered = Mustache.render(source.toString(), this.options.variables);
2627
return rendered;
2728
}
29+
30+
async validate(options: ValidateInput) : Promise<void> {
31+
const expected = await this.generate();
32+
33+
if (!options.found.includes(expected)) {
34+
this.report({
35+
expected,
36+
found: options.found,
37+
message: `${this.options.path} does not include the original template`
38+
});
39+
}
40+
}
2841
}
2942

3043
export function mustache (options: MustacheGeneratorOptions) {

0 commit comments

Comments
 (0)