File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,9 @@ async function generateProject(
282282 postProcessOptions ,
283283 ) ;
284284
285- await writeFile ( join ( targetDir , filePath ) , content ) ;
285+ const fullPath = join ( targetDir , filePath ) ;
286+ const { dirname} = await import ( 'path' ) ;
287+ await mkdir ( dirname ( fullPath ) , { recursive : true } ) ;
288+ await writeFile ( fullPath , content ) ;
286289 }
287290}
Original file line number Diff line number Diff line change @@ -65,16 +65,21 @@ export class TemplateEngine {
6565 return new Handlebars . SafeString ( result + '\n' ) ;
6666 } ) ;
6767
68+ this . handlebars . registerHelper ( 'eq' , ( a : any , b : any ) => {
69+ return a === b ;
70+ } ) ;
71+
6872 this . handlebars . registerHelper ( 'includeFile' , ( options : any ) => {
6973 if ( ! this . currentFile ) return '' ;
7074
71- const template = options . hash . template || '' ;
75+ const templatePath = options . hash . template || '' ;
7276 const outputTemplate = options . hash . output || '' ;
7377 const prettier = options . hash . prettier ;
7478 const transpile = options . hash . transpile ;
7579
76- if ( template && outputTemplate ) {
77- // Process the output path as a template
80+ if ( templatePath && outputTemplate ) {
81+ // Process both the template path and output path as templates
82+ const template = this . handlebars . compile ( templatePath ) ( this . context ) ;
7883 const output = this . handlebars . compile ( outputTemplate ) ( this . context ) ;
7984
8085 this . currentFile . includedFiles . push ( {
You can’t perform that action at this time.
0 commit comments