mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +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" ]
|
if [ "$1" != "DONTCOPY" ]
|
||||||
then
|
then
|
||||||
# Need to modify copy-trilium.sh to accept the target directory
|
# Need to modify copy-trilium.sh to accept the target directory
|
||||||
./bin/copy-trilium.sh "$PKG_DIR"
|
./bin/copy-trilium.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd dist
|
cd dist
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
set -e # Fail on any command error
|
set -e # Fail on any command error
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ; then
|
BUILD_DIR="./build"
|
||||||
echo "Missing argument of target directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! [[ $(which npm) ]]; then
|
if ! [[ $(which npm) ]]; then
|
||||||
echo "Missing npm"
|
echo "Missing npm"
|
||||||
exit 1
|
exit 1
|
||||||
@ -18,29 +16,29 @@ npm run build:prepare-dist
|
|||||||
echo Build finished
|
echo Build finished
|
||||||
|
|
||||||
# Patch package.json main
|
# 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)
|
# 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
|
# cleanup of useless files in dependencies
|
||||||
for d in 'image-q/demo' \
|
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' \
|
'@excalidraw/excalidraw/dist/excalidraw-assets-dev' '@excalidraw/excalidraw/dist/excalidraw.development.js' '@excalidraw/excalidraw/dist/excalidraw-with-preact.development.js' \
|
||||||
'mermaid/dist/mermaid.js' \
|
'mermaid/dist/mermaid.js' \
|
||||||
'boxicons/svg' 'boxicons/node_modules/react'/* \
|
'boxicons/svg' 'boxicons/node_modules/react'/* \
|
||||||
'@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
|
'@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
|
done
|
||||||
|
|
||||||
# delete all tests (there are often large images as test file for jimp etc.)
|
# delete all tests (there are often large images as test file for jimp etc.)
|
||||||
for d in 'test' 'docs' 'demo' 'example'; do
|
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
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find $DIR/libraries -name "*.map" -type f -delete
|
find $BUILD_DIR/libraries -name "*.map" -type f -delete
|
||||||
find $DIR/node_modules -name "*.map" -type f -delete
|
find $BUILD_DIR/node_modules -name "*.map" -type f -delete
|
||||||
find $DIR -name "*.ts" -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