Notes/bin/copy-trilium.sh
Panagiotis Papadopoulos bee7793d32 build(copy-trilium): remove now unnecessary package.json patching
this is not needed anymore since commit 6b9d8f0d677763f29d29abd0816b1a5d40e858c8
2025-03-26 08:12:48 +01:00

34 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e # Fail on any command error
shopt -s globstar
BUILD_DIR="./build"
if ! [[ $(which npm) ]]; then
echo "Missing npm"
exit 1
fi
if [[ -d "$BUILD_DIR"/node_modules ]]; then
# cleanup of useless files in dependencies
for d in 'image-q/demo' \
'@excalidraw/excalidraw/dist/excalidraw-assets-dev' '@excalidraw/excalidraw/dist/excalidraw.development.js' '@excalidraw/excalidraw/dist/excalidraw-with-preact.development.js' \
'mermaid/dist/mermaid.js' \
'boxicons/svg' 'boxicons/node_modules/react'/* \
'@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
[[ -e "$BUILD_DIR"/node_modules/"$d" ]] && rm -r "$BUILD_DIR"/node_modules/"$d"
done
# delete all tests (there are often large images as test file for jimp etc.)
for d in 'test' 'docs' 'demo' 'example'; do
find "$BUILD_DIR"/node_modules -name "$d" -exec rm -rf {} +
done
fi
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