Spaces:
Sleeping
Sleeping
File size: 783 Bytes
05c5ed5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import { rimraf } from "rimraf";
async function clean(dirsToClean?: string[]) {
try {
console.log("🧹 Cleaning up...");
// Default directories to clean if none provided
const defaultDirs = [".next", "node_modules", "tsconfig.tsbuildinfo"];
const dirs =
dirsToClean && dirsToClean.length > 0 ? dirsToClean : defaultDirs;
// Remove each specified directory
for (const dir of dirs) {
await rimraf(dir);
console.log(`✅ Removed ${dir} directory`);
}
console.log("✨ Cleanup completed successfully!");
} catch (error) {
console.error("❌ Error during cleanup:", error);
process.exit(1);
}
}
// Parse command line arguments, skip the first two (node and script path)
const args = process.argv.slice(2);
clean(args);
|