From 645ddd4df14ecf61e2dcb181277de280a8af251e Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sat, 29 Jun 2024 12:22:10 +0200 Subject: [PATCH] fix: skip remove src dir --- src/utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 6219e447..cb118dea 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -210,7 +210,14 @@ async function removeDir(dirPath: string) { const removedDirs = new Set() export async function removeOutputDir(output: OutputOptions, cwd: string) { const dir = output.dir - if (dir && dir !== cwd && !removedDirs.has(dir)) { + if ( + dir && + // not equal to cwd + dir !== cwd && + // not equal to src/ dir + dir !== path.resolve(cwd, SRC) && + !removedDirs.has(dir) + ) { await removeDir(dir) removedDirs.add(dir) }