From 9b3c9c16d54a7bf191c0abf86ca64d61a6257a02 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 29 Jun 2021 16:02:48 +0200 Subject: [PATCH] chore: updating stuff Signed-off-by: blam --- .../scaffolder/actions/builtin/fetch/template.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index ea376e76ab..445f36acbc 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -90,24 +90,26 @@ export function createFetchTemplateAction(options: { ctx.input.values, ); + // Grab some files const allFilesInTemplates = await globby(`*`, { cwd: templateDir }); + + // Nice for Cookiecutter compat nunjucks.installJinjaCompat(); + + // Create a templater const templater = nunjucks.configure({ tags: { - variableStart: '${', - variableEnd: '}', + variableStart: '${{', + variableEnd: '}}', }, autoescape: false, }); + // Need to work out how to autoescape but not this templater.addFilter('jsonify', s => JSON.stringify(s)); for (const location of allFilesInTemplates) { - console.log(location); - const filepath = templater.renderString(location, ctx.input.values); - console.log(filepath); - console.log('is', resolvePath(outputPath, filepath)); await fs.writeFile( resolvePath(outputPath, filepath), templater.renderString(