mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 23:37:54 +02:00
chore(scripts): add a way to wipe node modules
This commit is contained in:
24
scripts/wipe-node-modules.mts
Normal file
24
scripts/wipe-node-modules.mts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { rm } from "fs/promises";
|
||||
import { glob } from "glob";
|
||||
import path from "path";
|
||||
|
||||
const root = path.resolve(import.meta.dirname, "..");
|
||||
|
||||
const dirs = await glob([
|
||||
"node_modules",
|
||||
"apps/*/node_modules",
|
||||
"packages/*/node_modules"
|
||||
], {
|
||||
cwd: root,
|
||||
absolute: true
|
||||
});
|
||||
|
||||
if (dirs.length === 0) {
|
||||
console.log("No node_modules directories found.");
|
||||
} else {
|
||||
for (const dir of dirs) {
|
||||
console.log(`Removing ${path.relative(root, dir)}`);
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
console.log(`Done. Removed ${dirs.length} node_modules director${dirs.length === 1 ? "y" : "ies"}.`);
|
||||
}
|
||||
Reference in New Issue
Block a user