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(copy-trilium): do all the work inside build dir, no target directory needed anymore
Panagiotis Papadopoulos1ae5c430106a
diff --git a/bin/build-server.sh b/bin/build-server.shindex ff2912470d..17a50929bd 100755--- a/bin/build-server.sh+++ b/bin/build-server.sh@@ -43,7 +43,7 @@ echo "Package directory: $PKG_DIR"if [ "$1" != "DONTCOPY" ]then# Need to modify copy-trilium.sh to accept the target directory- ./bin/copy-trilium.sh "$PKG_DIR"+ ./bin/copy-trilium.shficd distdiff --git a/bin/copy-trilium.sh b/bin/copy-trilium.shindex bd3bd4a5a8..e7e688bffc 100755--- a/bin/copy-trilium.sh+++ b/bin/copy-trilium.sh@@ -3,10 +3,8 @@set -e # Fail on any command errorshopt -s globstar-if [[ $# -eq 0 ]] ; then- echo "Missing argument of target directory"- exit 1-fi+BUILD_DIR="./build"+if ! [[ $(which npm) ]]; thenecho "Missing npm"exit 1@@ -18,29 +16,29 @@ npm run build:prepare-distecho Build finished# Patch package.json main-sed -i 's/.\/dist\/electron-main.js/electron-main.js/g' "$DIR/package.json"+sed -i 's/.\/dist\/electron-main.js/electron-main.js/g' "$BUILD_DIR/package.json"# run in subshell (so we return to original dir)-(cd $DIR && npm ci --omit=dev)+(cd $BUILD_DIR && npm ci --omit=dev)-if [[ -d "$DIR"/node_modules ]]; then+if [[ -d "$BUILD_DIR"/node_modules ]]; then# cleanup of useless files in dependenciesfor 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 "$DIR"/node_modules/"$d" ]] && rm -r "$DIR"/node_modules/"$d"+ [[ -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 "$DIR"/node_modules -name "$d" -exec rm -rf {} ++ find "$BUILD_DIR"/node_modules -name "$d" -exec rm -rf {} +donefi-find $DIR/libraries -name "*.map" -type f -delete-find $DIR/node_modules -name "*.map" -type f -delete-find $DIR -name "*.ts" -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 DIR+unset f d BUILD_DIR