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);