From 7f9cd55192ce76631923b412219ef3baeb7d1cbc Mon Sep 17 00:00:00 2001 From: Teppei Sato Date: Fri, 26 Aug 2022 01:03:08 +0900 Subject: [PATCH] fix(soy): clean:soy throws an error when outputDirectory used (#795) --- src/commands/cleanSoy.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/commands/cleanSoy.ts b/src/commands/cleanSoy.ts index dc4e32cc7..866a7e30e 100644 --- a/src/commands/cleanSoy.ts +++ b/src/commands/cleanSoy.ts @@ -10,14 +10,18 @@ export type CleanSoyConfig = Required>; export async function cleanSoy(config: CleanSoyConfig): Promise { const { outputPathFormat, outputDirectory } = config.soyOptions; let outputPath = outputDirectory; - if (!outputPath && outputPathFormat) { - outputPath = resolveOutputPathFormat(assertString(outputPathFormat), { - inputDirectory: "/**/", - inputFileName: "*", - inputFileNameNoExt: "*", - }); - } else { - throw new TypeError("Must set either outputPathFormat or outputDirectory"); + if (!outputPath) { + if (outputPathFormat) { + outputPath = resolveOutputPathFormat(assertString(outputPathFormat), { + inputDirectory: "/**/", + inputFileName: "*", + inputFileNameNoExt: "*", + }); + } else { + throw new TypeError( + "Must set either outputPathFormat or outputDirectory" + ); + } } logger.info(`rm ${outputPath}`); await util.promisify(rimraf)(outputPath);