mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
build(copy-trilium): do all the work inside build dir, no target directory needed anymore
-> all of these steps will eventually be merged with copy-dist script to have a unified copying script
This commit is contained in:
parent
f8b06f0634
commit
1ae5c43010
@ -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.sh
|
||||
fi
|
||||
|
||||
cd dist
|
||||
|
@ -3,10 +3,8 @@
|
||||
set -e # Fail on any command error
|
||||
shopt -s globstar
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo "Missing argument of target directory"
|
||||
exit 1
|
||||
fi
|
||||
BUILD_DIR="./build"
|
||||
|
||||
if ! [[ $(which npm) ]]; then
|
||||
echo "Missing npm"
|
||||
exit 1
|
||||
@ -18,29 +16,29 @@ npm run build:prepare-dist
|
||||
echo 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 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 "$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 {} +
|
||||
done
|
||||
fi
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user