build(copy-dist): add further cleanupNodeModules functionality

deleting of ts and map files from node_modules folder,
adapted from copy-trilium.sh.
This commit is contained in:
Panagiotis Papadopoulos 2025-03-16 02:15:17 +01:00
parent 8275f3c867
commit 6749d8084b
2 changed files with 13 additions and 2 deletions

View File

@ -87,5 +87,18 @@ function cleanupNodeModules() {
.map(el => path.join(DEST_DIR, el.parentPath, el.name)) .map(el => path.join(DEST_DIR, el.parentPath, el.name))
.forEach(dir => fs.removeSync(dir)); .forEach(dir => fs.removeSync(dir));
// Delete unnecessary files based on file extension
const filterableFileExt = new Set([
"ts",
"map"
])
nodeDir
// TriliumNextTODO: check if we can improve this naive file ext matching
.filter(el => el.isFile() && filterableFileExt.has(el.name.split(".").at(-1) || ""))
.map(file => path.join(DEST_DIR, file.parentPath, file.name))
.forEach(file => fs.removeSync(file));
} }

View File

@ -22,7 +22,5 @@ if [[ -d "$BUILD_DIR"/node_modules ]]; then
fi fi
find $BUILD_DIR/libraries -name "*.map" -type f -delete find $BUILD_DIR/libraries -name "*.map" -type f -delete
find $BUILD_DIR/node_modules -name "*.map" -type f -delete
find $BUILD_DIR -name "*.ts" -type f -delete
unset f d BUILD_DIR unset f d BUILD_DIR