update,
This commit is contained in:
42
clear_node_modules.js
Normal file
42
clear_node_modules.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
function removeNodeModules(dir) {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
if (
|
||||
[
|
||||
"_poc",
|
||||
"_archive",
|
||||
//
|
||||
].includes(entry.name)
|
||||
) {
|
||||
} else {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
if (["node_modules", ".next"].includes(entry.name)) {
|
||||
fs.rmSync(fullPath, { recursive: true });
|
||||
} else {
|
||||
removeNodeModules(fullPath);
|
||||
}
|
||||
|
||||
if (
|
||||
[
|
||||
".apk",
|
||||
".log",
|
||||
".tmp",
|
||||
".Zone.Identifier",
|
||||
//
|
||||
].some((ext) => entry.name.endsWith(ext))
|
||||
) {
|
||||
fs.unlinkSync(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeNodeModules(".");
|
||||
console.log("directories have been removed.");
|
Reference in New Issue
Block a user