scaffolder: fix templating all files in sub directories for nunjucks action

Co-authored-by: Mike Lewis <mtlewis@users.noreply.github.com>
Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
Himanshu Mishra
2021-07-02 11:31:19 +02:00
parent 01e13e173d
commit 333db5f4dd
@@ -98,8 +98,8 @@ export function createFetchTemplateAction(options: {
// Grab some files
//
// TODO(mtlewis/orkohunter) handle subdirectories
const allFilesInTemplates = await globby(`*`, { cwd: templateDir });
// TODO(mtlewis/orkohunter) test whether empty directories are templated
const allFilesInTemplates = await globby(`**/*`, { cwd: templateDir });
// Nice for Cookiecutter compat
//
@@ -123,7 +123,7 @@ export function createFetchTemplateAction(options: {
const filepath = templater.renderString(location, ctx.input.values);
// write file
await fs.writeFile(
await fs.outputFile(
resolvePath(outputPath, filepath),
templater.renderString(
await fs.readFile(resolvePath(templateDir, location), 'utf-8'),