Skip to content

Commit

Permalink
Fix compiler bug not deleting output folder
Browse files Browse the repository at this point in the history
Fix bug caused by using wrong variable name, simplify recursive
directory clean-up code.
  • Loading branch information
undergroundwires committed Dec 28, 2024
1 parent 26b9c52 commit 85a6e06
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,5 @@ async function compileWithClosureAsync(code, output, options) {
}

async function deleteFolderRecursiveAsync(folderPath) {
if (!fs.existsSync(folderPath)) {
return;
}
const directoryContents = await fs.promises.readdir(folderPath);
await Promise.all(directoryContents.map(async (innerFilePath) => {
const innerPath = `${folderPath}/${innerFilePath}`;
if ((await fs.promises.lstat(innerPath)).isDirectory()) {
await deleteFolderRecursiveAsync(innerPath);
} else {
await fs.promises.unlink(innerPath);
}
}));
await fs.promises.rmdir(path);
await fs.promises.rmdir(folderPath, { recursive: true, force: true });
}

0 comments on commit 85a6e06

Please sign in to comment.