INNER CODE UNIT · TypeScript
debugWriteNunjucksTemplate
org-formation/org-formation-cli · src/yaml-cfn/index.ts:154
export const debugWriteNunjucksTemplate = (filename: string, input: string, templatingContext: any, output: string): void => {
try {
const outputPath = path.resolve(NunjucksDebugSettings.path, path.basename(filename));
mkdirSync(outputPath, { recursive: true });
writeFileSync(path.join(outputPath, 'input.txt'), input);
writeFileSync(path.join(outputPath, 'output.txt'), output);
writeFileSync(path.join(outputPath, 'templating-context.json'), JSON.stringify(templatingContext, undefined, 2));
} catch (err) {
ConsoleUtil.LogError('error writing text templating debug info to disk: ' + filename, err);
}
};
export const NunjucksDebugSettings = {
debug: false,
path: './.nunjucks-debug/',
};