Skip to content

Commit 9647738

Browse files
authored
Merge pull request #252 from TriliumNext/feature/update_reduce_binary_size
Reduce dist size
2 parents 5b81482 + 758c08e commit 9647738

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

bin/copy-trilium.sh

+14-7
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,28 @@ cp -Rv "$script_dir/../build/src" "$DIR"
4040
cp "$script_dir/../build/electron.js" "$DIR"
4141

4242
# run in subshell (so we return to original dir)
43-
(cd $DIR && npm install --only=prod)
43+
(cd $DIR && npm install --omit=dev)
4444

4545
if [[ -d "$DIR"/node_modules ]]; then
46-
# cleanup of useless files in dependencies
47-
for d in 'image-q/demo' 'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
48-
[[ -e "$DIR"/node_modules/"$d" ]] && rm -rv "$DIR"/node_modules/"$d"
46+
# cleanup of useless files in dependencies
47+
for d in 'image-q/demo' \
48+
'@excalidraw/excalidraw/dist/excalidraw-assets-dev' '@excalidraw/excalidraw/dist/excalidraw.development.js' '@excalidraw/excalidraw/dist/excalidraw-with-preact.development.js' \
49+
'mermaid/dist/mermaid.js' \
50+
'boxicons/svg' 'boxicons/node_modules/react'/* \
51+
'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' 'better-sqlite3/deps/sqlite3' \
52+
'@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
53+
[[ -e "$DIR"/node_modules/"$d" ]] && rm -r "$DIR"/node_modules/"$d"
4954
done
5055

51-
# delete all tests (there are often large images as test file for jimp etc.)
52-
for d in 'test' 'docs' 'demo'; do
53-
find "$DIR"/node_modules -name "$d" -exec rm -rf {} \;
56+
# delete all tests (there are often large images as test file for jimp etc.)
57+
for d in 'test' 'docs' 'demo' 'example'; do
58+
find "$DIR"/node_modules -name "$d" -exec rm -rf {} +
5459
done
5560
fi
5661

5762
find $DIR/libraries -name "*.map" -type f -delete
63+
find $DIR/node_modules -name "*.map" -type f -delete
64+
find $DIR -name "*.ts" -type f -delete
5865

5966
d="$DIR"/src/public
6067
[[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist

package-lock.json

+19-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
"react": "^18.3.1",
8989
"react-dom": "^18.3.1",
9090
"request": "2.88.2",
91-
"rimraf": "^6.0.1",
9291
"safe-compare": "1.1.4",
9392
"sanitize-filename": "1.6.3",
9493
"sanitize-html": "^2.13.0",
@@ -146,6 +145,7 @@
146145
"lorem-ipsum": "2.0.8",
147146
"nodemon": "^3.1.4",
148147
"rcedit": "4.0.1",
148+
"rimraf": "^6.0.1",
149149
"ts-node": "^10.9.2",
150150
"tslib": "^2.6.2",
151151
"typescript": "^5.3.3",

0 commit comments

Comments
 (0)