add template replace option

Signed-off-by: pitwegner <pit.wegner@gmail.com>
Signed-off-by: pitwegner <pit.wegner@student.hpi.de>
This commit is contained in:
pitwegner
2023-01-17 11:08:32 +01:00
committed by pitwegner
parent a3667f609c
commit b284705dc0
@@ -118,6 +118,12 @@ export function createFetchTemplateAction(options: {
'If set, only files with the given extension will be templated. If set to `true`, the default extension `.njk` is used.',
type: ['string', 'boolean'],
},
replace: {
title: 'Replace files',
description:
'If set, replace files in targetPath instead of skipping existing ones.',
type: 'boolean',
},
},
},
},
@@ -261,7 +267,7 @@ export function createFetchTemplateAction(options: {
}
const outputPath = resolveSafeChildPath(outputDir, localOutputPath);
if (fs.existsSync(outputPath)) {
if (fs.existsSync(outputPath) && !ctx.input.replace) {
continue;
}