File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ export default async function (root: string, variables: Variables) {
9898 "scripts/clean.ts" : copy ( join ( __dirname , "content" , "clean.ts" ) ) ,
9999 ".github/workflows/ci.yml" : mustache ( {
100100 sourcePath : join ( __dirname , "content" , "ci.yml" ) ,
101- variables,
101+ variables : variables . ci ,
102102 } ) ,
103103 ".github/matchers/tap.json" : copy ( join ( __dirname , "content" , "tap.json" ) ) ,
104104 } ;
Original file line number Diff line number Diff line change 1- import { Generator } from "code-skeleton/lib/generators/abstract" ;
1+ import { Generator , ValidateInput } from "code-skeleton/lib/generators/abstract" ;
2+ import { GeneratorReportResult } from "code-skeleton/lib/generators/report" ;
23import { readFile } from "node:fs/promises" ;
34import Mustache from "mustache" ;
45Mustache . tags = [ "<%" , "%>" ] ;
@@ -25,6 +26,20 @@ 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 < GeneratorReportResult > {
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 . sourcePath } does not include the original template`
38+ } ) ;
39+ return GeneratorReportResult . Fail ;
40+ }
41+ return GeneratorReportResult . Pass ;
42+ }
2843}
2944
3045export function mustache ( options : MustacheGeneratorOptions ) {
You can’t perform that action at this time.
0 commit comments