Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
build(cleanupNodeModules): move removal of elements to its own function
Panagiotis Papadopoulos0b428035ae02
diff --git a/bin/cleanupNodeModules.ts b/bin/cleanupNodeModules.tsindex c5df07da99..d811c95a1d 100644--- a/bin/cleanupNodeModules.ts+++ b/bin/cleanupNodeModules.ts@@ -45,7 +45,7 @@ function cleanupNodeModules(basePath: string) {nodeModulesContent.filter(el => el.isDirectory() && filterableDirs.has(el.name))- .forEach(dir => fs.removeSync(path.join(dir.parentPath, dir.name)));+ .forEach(dir => removeDirent(dir));/*** Delete unnecessary files based on file extension@@ -59,7 +59,7 @@ function cleanupNodeModules(basePath: string) {nodeModulesContent// TriliumNextTODO: check if we can improve this naive file ext matching, without introducing any additional dependency.filter(el => el.isFile() && filterableFileExt.has(el.name.split(".").at(-1) || ""))- .forEach(file => fs.removeSync(path.join(file.parentPath, file.name)));+ .forEach(dir => removeDirent(dir));/**@@ -79,7 +79,17 @@ function cleanupNodeModules(basePath: string) {nodeModulesContent.filter(el => el.isDirectory() && extraFoldersDelete.has(path.join(el.parentPath, el.name)))- .forEach(dir => fs.removeSync(path.join(dir.parentPath, dir.name)))+ .forEach(dir => removeDirent(dir))+}++function removeDirent(el: Dirent) {+ const elementToDelete = path.join(el.parentPath, el.name);+ fs.removeSync(elementToDelete);++ if (process.env.VERBOSE) {+ console.log(`Deleted ${elementToDelete}`);+ }+}