trilium/bin/copy-trilium.sh

37 lines
770 B
Bash
Raw Normal View History

2019-10-12 03:22:59 +08:00
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo "Missing argument of target directory"
exit 1
fi
2020-04-21 05:14:50 +08:00
npm run webpack
2019-10-12 03:22:59 +08:00
DIR=$1
rm -rf $DIR
mkdir $DIR
echo "Copying Trilium to build directory $DIR"
cp -r images $DIR/
cp -r libraries $DIR/
cp -r src $DIR/
cp -r db $DIR/
cp -r package.json $DIR/
cp -r package-lock.json $DIR/
cp -r README.md $DIR/
cp -r LICENSE $DIR/
cp -r config-sample.ini $DIR/
cp -r electron.js $DIR/
2020-04-12 20:22:51 +08:00
cp webpack-* $DIR/
2019-10-12 03:22:59 +08:00
# run in subshell (so we return to original dir)
2020-04-21 05:14:50 +08:00
(cd $DIR && npm install --only=prod)
2019-10-12 03:22:59 +08:00
2020-04-12 20:22:51 +08:00
find $DIR/libraries -name "*.map" -type f -delete
2020-04-15 03:57:42 +08:00
rm -r $DIR/src/public/app
2020-04-12 20:22:51 +08:00
2020-04-15 03:57:42 +08:00
sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs
sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs