Refactor directory checks into a separate function to clean up the download function

pull/4685/head
rasheed 1 month ago
parent 8434d44998
commit 5339de67a7

@ -26,16 +26,15 @@ function download(url) {
if (response.statusCode === 200) {
console.log("Extracting dist...");
function handleDirectoryCleanup() {
if (fs.existsSync("./dist")) {
if (fs.existsSync("./dist-backup")) {
rmSync("./dist-backup", {
recursive: true
});
rmSync("./dist-backup", { recursive: true });
}
fs.renameSync("./dist", "./dist-backup");
}
}
}
const tarStream = tar.x({
cwd: "./",

Loading…
Cancel
Save