Skip to content

Commit

Permalink
fix(soy): clean:soy throws an error when outputDirectory used (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
teppeis committed Aug 25, 2022
1 parent fae58c8 commit 7f9cd55
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/commands/cleanSoy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ export type CleanSoyConfig = Required<Pick<DuckConfig, "soyOptions">>;
export async function cleanSoy(config: CleanSoyConfig): Promise<string> {
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);
Expand Down

0 comments on commit 7f9cd55

Please sign in to comment.