mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	Merge pull request #294 from JYC333/sql
Remove hard-coded better-sqlite3 binaries
This commit is contained in:
		
						commit
						061b0c981d
					
				
							
								
								
									
										145
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										145
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							| @ -18,8 +18,47 @@ concurrency: | ||||
|   cancel-in-progress: true | ||||
| 
 | ||||
| jobs: | ||||
|   build_darwin-x64: | ||||
|     name: Build macOS x86_64 | ||||
|   build_darwin: | ||||
|     name: Build macOS (x86_64, arm64) | ||||
|     runs-on: macos-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Set up node & dependencies | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - name: Run MacOS installer build (x86_64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           npm run make-electron -- --arch="x64" | ||||
|       - name: Publish MacOS zip artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for MacOS (x86_64) | ||||
|           path: out/make/zip/darwin/x64/*.zip | ||||
|       - name: Publish MacOS installer artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for MacOS (Setup) (x86_64) | ||||
|           path: out/make/*-x64.dmg | ||||
|       - name: Run MacOS installer build (arm64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           npm run make-electron -- --arch="arm64" | ||||
|       - name: Publish MacOS zip artifact (arm64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for MacOS (arm64) | ||||
|           path: out/make/zip/darwin/arm64/*.zip | ||||
|       - name: Publish MacOS installer artifact (arm64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for MacOS (Setup) (arm64) | ||||
|           path: out/make/*-arm64.dmg   | ||||
|   build_linux: | ||||
|     name: Build Linux (x86_64, arm64) | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
| @ -29,53 +68,34 @@ jobs: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: | | ||||
|       - name: Run Linux installer build (x86_64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           ./bin/build-mac-x64.sh | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|           npm run make-electron -- --arch="x64" | ||||
|       - name: Publish Linux zip artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-mac-x64.zip | ||||
|           path: dist/trilium-mac-x64*.zip | ||||
|   build_darwin-arm64: | ||||
|     name: Build macOS aarch64 | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Set up node & dependencies | ||||
|         uses: actions/setup-node@v4 | ||||
|           name: TriliumNext Notes for Linux | ||||
|           path: out/make/zip/linux/x64/*.zip | ||||
|       - name: Publish Linux installer artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: | | ||||
|           name: TriliumNext Notes for Linux (Setup) | ||||
|           path: out/make/deb/x64/*.deb | ||||
|       - name: Run Linux installer build (arm64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           ./bin/build-mac-arm64.sh | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|           npm run make-electron -- --arch="arm64" | ||||
|       - name: Publish Linux zip artifact (arm64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-mac-arm64.zip | ||||
|           path: dist/trilium-mac-arm64*.zip | ||||
|   build_linux-x64: | ||||
|     name: Build Linux x86_64 | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Set up node & dependencies | ||||
|         uses: actions/setup-node@v4 | ||||
|           name: TriliumNext Notes for Linux | ||||
|           path: out/make/zip/linux/arm64/*.zip | ||||
|       - name: Publish Linux installer artifact (arm64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: | | ||||
|           npm run update-build-info | ||||
|           ./bin/build-linux-x64.sh | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-linux-x64.tar.xz | ||||
|           path: dist/trilium-linux-x64-*.tar.xz | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium_amd64.deb | ||||
|           path: dist/trilium_*.deb | ||||
|           name: TriliumNext Notes for Linux (Setup) | ||||
|           path: out/make/deb/arm64/*.deb | ||||
|   build_linux_server-x64: | ||||
|     name: Build Linux Server x86_64 | ||||
|     runs-on: ubuntu-latest | ||||
| @ -87,40 +107,16 @@ jobs: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: | | ||||
|       - name: Run Linux server build (x86_64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           ./bin/build-server.sh | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-linux-x64-server.tar.xz | ||||
|           path: dist/trilium-linux-x64-server-*.tar.xz | ||||
|   build_windows-x64: | ||||
|   build_windows: | ||||
|     name: Build Windows x86_64 | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Set up Wine | ||||
|         run: | | ||||
|           sudo dpkg --add-architecture i386 | ||||
|           wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - | ||||
|           sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport | ||||
|           sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main" | ||||
|           sudo apt install --install-recommends winehq-stable | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Set up node & dependencies | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: | | ||||
|           npm run update-build-info | ||||
|           ./bin/build-win-x64.sh DONTPACK | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-windows-x64 | ||||
|           path: dist/trilium-windows-x64 | ||||
|   build_windows-installer: | ||||
|     name: Build Windows x86_64 (Setup) | ||||
|     runs-on: windows-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
| @ -130,11 +126,16 @@ jobs: | ||||
|           node-version: 20 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - name: Run installer build | ||||
|       - name: Run Windows installer build (x86_64) | ||||
|         run: | | ||||
|           npm run update-build-info | ||||
|           npm run make-electron | ||||
|       - name: Publish installer artifact | ||||
|       - name: Publish Windows zip artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for Windows | ||||
|           path: out/make/zip/win32/x64/*.zip | ||||
|       - name: Publish Windows installer artifact (x86_64) | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: TriliumNext Notes for Windows (Setup) | ||||
|  | ||||
							
								
								
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @ -11,4 +11,7 @@ | ||||
|     "[jsonc]": { | ||||
|         "editor.defaultFormatter": "vscode.json-language-features" | ||||
|     }, | ||||
|     "[javascript]": { | ||||
|         "editor.defaultFormatter": "vscode.typescript-language-features" | ||||
|     }, | ||||
| } | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,38 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| ELECTRON_VERSION="electron-v125" | ||||
| NODE_VERSION="node-v115" | ||||
| 
 | ||||
| if ! command -v jq &> /dev/null; then | ||||
|   echo "Missing command: jq" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| script_dir=$(realpath $(dirname $0)) | ||||
| cd "$script_dir" | ||||
| BETTER_SQLITE3_VERSION=$(jq -r '.dependencies.["better-sqlite3"]' ../../package.json | grep -oP "\d+\.\d+\.\d+") | ||||
| 
 | ||||
| if [ -z $BETTER_SQLITE3_VERSION ]; then | ||||
|     echo "Unable to determine better-sqlite3 version." | ||||
|     exit 2 | ||||
| fi | ||||
| 
 | ||||
| echo "Version: $BETTER_SQLITE3_VERSION" | ||||
| 
 | ||||
| function download() { | ||||
|     version="$1" | ||||
|     platform="$2" | ||||
|     dest_name="$3" | ||||
|     url=https://github.com/WiseLibs/better-sqlite3/releases/download/v${BETTER_SQLITE3_VERSION}/better-sqlite3-v${BETTER_SQLITE3_VERSION}-${version}-${platform}.tar.gz | ||||
|     temp_file="temp.tar.gz" | ||||
|     curl -L "$url" -o "$temp_file" | ||||
|     tar -xzvf "$temp_file" | ||||
|     mv build/Release/better_sqlite3.node "$dest_name-better_sqlite3.node" | ||||
|     rm -rf build | ||||
|     rm -f "$temp_file" | ||||
| } | ||||
| 
 | ||||
| download $NODE_VERSION "linux-x64" "linux-server" | ||||
| download $ELECTRON_VERSION "linux-x64" "linux-desktop" | ||||
| download $ELECTRON_VERSION "win32-x64" "win" | ||||
| download $ELECTRON_VERSION "darwin-x64" "mac-x64" | ||||
| download $ELECTRON_VERSION "darwin-arm64" "mac-arm64" | ||||
										
											Binary file not shown.
										
									
								
							| @ -1,19 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -e  # Fail on any command error | ||||
| 
 | ||||
| if ! command -v dpkg-deb &> /dev/null; then | ||||
|   echo "Missing command: dpkg-deb" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then | ||||
|   echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead." | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| echo "Packaging debian x64 distribution..." | ||||
| 
 | ||||
| VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
| ./node_modules/.bin/electron-installer-debian --config bin/deb-options.json --options.version=${VERSION} --arch amd64 | ||||
| @ -1,58 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -e  # Fail on any command error | ||||
| 
 | ||||
| if ! command -v jq &> /dev/null; then | ||||
|   echo "Missing command: jq" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if ! command -v fakeroot &> /dev/null; then | ||||
|   echo "Missing command: fakeroot" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if ! command -v dpkg-deb &> /dev/null; then | ||||
|   echo "Missing command: dpkg-deb" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then | ||||
|   echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead." | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| SRC_DIR=./dist/trilium-linux-x64-src | ||||
| 
 | ||||
| [ "$1" != "DONTCOPY" ] && ./bin/copy-trilium.sh "$SRC_DIR" | ||||
| 
 | ||||
| echo "Copying required linux-x64 binaries" | ||||
| cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node "$SRC_DIR"/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| echo "Packaging linux x64 electron build" | ||||
| ./node_modules/.bin/electron-packager "$SRC_DIR" --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite | ||||
| 
 | ||||
| BUILD_DIR=./dist/trilium-linux-x64 | ||||
| rm -rf "$BUILD_DIR" | ||||
| 
 | ||||
| mv "./dist/TriliumNext Notes-linux-x64" "$BUILD_DIR" | ||||
| 
 | ||||
| cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png | ||||
| cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/ | ||||
| 
 | ||||
| cp -r dump-db "$BUILD_DIR"/ | ||||
| rm -rf "$BUILD_DIR"/dump-db/node_modules | ||||
| 
 | ||||
| for f in 'trilium-portable' 'trilium-safe-mode' 'trilium-no-cert-check'; do | ||||
|     cp bin/tpl/"$f".sh "$BUILD_DIR"/ | ||||
|     chmod 755 "$BUILD_DIR"/"$f".sh | ||||
| done | ||||
| 
 | ||||
| echo "Packaging linux x64 electron distribution..." | ||||
| VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
| pushd dist | ||||
|     tar cJf "trilium-linux-x64-${VERSION}.tar.xz" trilium-linux-x64 | ||||
| popd | ||||
| 
 | ||||
| bin/build-debian.sh | ||||
| @ -1,37 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -e  # Fail on any command error | ||||
| 
 | ||||
| SRC_DIR=./dist/trilium-mac-arm64-src | ||||
| 
 | ||||
| if [ "$1" != "DONTCOPY" ] | ||||
| then | ||||
|     ./bin/copy-trilium.sh $SRC_DIR | ||||
| fi | ||||
| 
 | ||||
| echo "Copying required mac arm64 binaries" | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/mac-arm64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| echo "Packaging mac arm64 electron build" | ||||
| 
 | ||||
| ./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=arm64 --overwrite --icon=images/app-icons/mac/icon.icns | ||||
| 
 | ||||
| BUILD_DIR=./dist/trilium-mac-arm64 | ||||
| rm -rf $BUILD_DIR | ||||
| 
 | ||||
| # Mac build has by default useless directory level | ||||
| mv "./dist/TriliumNext Notes-darwin-arm64" $BUILD_DIR | ||||
| 
 | ||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||
| 
 | ||||
| cp -r dump-db $BUILD_DIR/ | ||||
| rm -rf $BUILD_DIR/dump-db/node_modules | ||||
| 
 | ||||
| echo "Zipping mac arm64 electron distribution..." | ||||
| 
 | ||||
| VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
| cd dist | ||||
| 
 | ||||
| zip -r9 --symlinks trilium-mac-arm64-${VERSION}.zip trilium-mac-arm64 | ||||
| @ -1,37 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -e  # Fail on any command error | ||||
| 
 | ||||
| SRC_DIR=./dist/trilium-mac-x64-src | ||||
| 
 | ||||
| if [ "$1" != "DONTCOPY" ] | ||||
| then | ||||
|     ./bin/copy-trilium.sh $SRC_DIR | ||||
| fi | ||||
| 
 | ||||
| echo "Copying required mac x64 binaries" | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/mac-x64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| echo "Packaging mac x64 electron build" | ||||
| 
 | ||||
| ./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=x64 --overwrite --icon=images/app-icons/mac/icon.icns | ||||
| 
 | ||||
| BUILD_DIR=./dist/trilium-mac-x64 | ||||
| rm -rf $BUILD_DIR | ||||
| 
 | ||||
| # Mac build has by default useless directory level | ||||
| mv "./dist/TriliumNext Notes-darwin-x64" $BUILD_DIR | ||||
| 
 | ||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||
| 
 | ||||
| cp -r dump-db $BUILD_DIR/ | ||||
| rm -rf $BUILD_DIR/dump-db/node_modules | ||||
| 
 | ||||
| echo "Zipping mac x64 electron distribution..." | ||||
| 
 | ||||
| VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
| cd dist | ||||
| 
 | ||||
| zip -r9 --symlinks trilium-mac-x64-${VERSION}.zip trilium-mac-x64 | ||||
| @ -24,8 +24,6 @@ rm -r $PKG_DIR/node/include/node | ||||
| rm -r $PKG_DIR/node_modules/electron* | ||||
| rm -r $PKG_DIR/electron.js | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh | ||||
| chmod 755 $PKG_DIR/trilium.sh | ||||
| 
 | ||||
|  | ||||
| @ -1,44 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -e  # Fail on any command error | ||||
| 
 | ||||
| if ! command -v wine &> /dev/null; then | ||||
|   echo "Missing command: wine" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| SRC_DIR=./dist/trilium-windows-x64-src | ||||
| 
 | ||||
| if [ "$1" != "DONTCOPY" ] | ||||
| then | ||||
|     ./bin/copy-trilium.sh $SRC_DIR | ||||
| fi | ||||
| 
 | ||||
| echo "Copying required windows binaries" | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/win-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| echo "Packaging windows x64 electron build" | ||||
| 
 | ||||
| ./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=win32  --arch=x64 --overwrite --icon=images/app-icons/win/icon.ico | ||||
| 
 | ||||
| BUILD_DIR=./dist/trilium-windows-x64 | ||||
| rm -rf $BUILD_DIR | ||||
| 
 | ||||
| mv "./dist/TriliumNext Notes-win32-x64" $BUILD_DIR | ||||
| 
 | ||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||
| 
 | ||||
| cp -r dump-db $BUILD_DIR/ | ||||
| rm -rf $BUILD_DIR/dump-db/node_modules | ||||
| 
 | ||||
| cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/ | ||||
| 
 | ||||
| if [ "$1" != "DONTPACK" ] | ||||
| then | ||||
|   echo "Zipping windows x64 electron distribution..." | ||||
|   VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
|   cd dist | ||||
|   zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64 | ||||
| fi | ||||
| @ -52,7 +52,6 @@ if [[ -d "$DIR"/node_modules ]]; then | ||||
|         '@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'/* \ | ||||
|         'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' 'better-sqlite3/deps/sqlite3' \ | ||||
|         '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do | ||||
|         [[ -e "$DIR"/node_modules/"$d" ]] && rm -r "$DIR"/node_modules/"$d" | ||||
|     done | ||||
|  | ||||
| @ -39,7 +39,7 @@ done | ||||
| icnsutil compose -f "mac/icon.icns" ./mac/*.png | ||||
| 
 | ||||
| # Build Windows icon | ||||
| magick -background none "../icon-color.svg" -define icon:auto-resize=16,32,48,64,128,256 "./win/icon.ico" | ||||
| magick -background none "../icon-color.svg" -define icon:auto-resize=16,32,48,64,128,256 "./icon.ico" | ||||
| 
 | ||||
| # Build Squirrel splash image | ||||
| magick "./png/256x256.png" -background "#ffffff" -gravity center -extent 640x480 "./win/setup-banner.gif" | ||||
| @ -1,18 +1,67 @@ | ||||
| const path = require('path'); | ||||
| const fs = require('fs-extra'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   packagerConfig: { | ||||
|     executableName: "trilium", | ||||
|     name: 'TriliumNextNotes', | ||||
|     overwrite: true, | ||||
|     asar: true, | ||||
|     // icon will break once we add .dmg support, since the .ico & .icns have to be in same dir (see https://www.electronforge.io/guides/create-and-add-icons#windows-and-macos)
 | ||||
|     icon: "./images/app-icons/win/icon" | ||||
|     icon: "./images/app-icons/icon", | ||||
|     extraResource: getExtraResourcesForPlatform(), | ||||
|     afterComplete: [(buildPath, electronVersion, platform, arch, callback) => { | ||||
|       const extraResources = getExtraResourcesForPlatform(); | ||||
|       for (const resource of extraResources) { | ||||
|         let sourcePath; | ||||
|         if (platform === 'darwin') { | ||||
|           sourcePath = path.join(buildPath, 'TriliumNextNotes.app', 'Content', 'Resources', path.basename(resource)); | ||||
|         } else { | ||||
|           sourcePath = path.join(buildPath, 'resources', path.basename(resource)); | ||||
|         } | ||||
|         const destPath = path.join(buildPath, path.basename(resource)); | ||||
| 
 | ||||
|         // Copy files from resources folder to root
 | ||||
|         fs.move(sourcePath, destPath) | ||||
|           .then(() => callback()) | ||||
|           .catch(err => callback(err)); | ||||
|       } | ||||
|     }] | ||||
|   }, | ||||
|   rebuildConfig: { | ||||
|     force: true | ||||
|   }, | ||||
|   rebuildConfig: {}, | ||||
|   makers: [ | ||||
|     { | ||||
|       name: '@electron-forge/maker-deb', | ||||
|       config: { | ||||
|         options: { | ||||
|           icon: "./images/app-icons/png/128x128.png", | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       name: '@electron-forge/maker-squirrel', | ||||
|       config: { | ||||
|         iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/win/icon.ico", | ||||
|         setupIcon: "./images/app-icons/win/icon.ico", | ||||
|         iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | ||||
|         setupIcon: "./images/app-icons/icon.ico", | ||||
|         loadingGif: "./images/app-icons/win/setup-banner.gif" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       name: '@electron-forge/maker-dmg', | ||||
|       config: { | ||||
|         icon: "./images/app-icons/icon.icns", | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       name: '@electron-forge/maker-zip', | ||||
|       config: { | ||||
|         options: { | ||||
|           iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | ||||
|           icon: "./images/app-icons/icon.ico", | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   ], | ||||
|   plugins: [ | ||||
| @ -22,3 +71,27 @@ module.exports = { | ||||
|     }, | ||||
|   ], | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| function getExtraResourcesForPlatform() { | ||||
|   let resources = ['dump-db/', './bin/tpl/anonymize-database.sql'] | ||||
|   const scripts = ['trilium-portable', 'trilium-safe-mode', 'trilium-no-cert-check'] | ||||
|   switch (process.platform) { | ||||
|     case 'win32': | ||||
|       for (const script of scripts) { | ||||
|         resources.push(`./bin/tpl/${script}.bat`) | ||||
|       } | ||||
|       break; | ||||
|     case 'darwin': | ||||
|       break; | ||||
|     case 'linux': | ||||
|       for (const script of scripts) { | ||||
|         resources.push(`./bin/tpl/${script}.sh`) | ||||
|       } | ||||
|       break; | ||||
|     default: | ||||
|       break; | ||||
|   } | ||||
| 
 | ||||
|   return resources; | ||||
| } | ||||
| Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB | 
							
								
								
									
										2438
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2438
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
								
							| @ -23,19 +23,17 @@ | ||||
|     "start-server": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||
|     "start-server-safe": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||
|     "start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||
|     "qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||
|     "start-electron": "rimraf ./dist && tsc && tsx ./bin/copy-dist.ts && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", | ||||
|     "start-test-server": "npm run switch-server; rimraf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 ts-node src/www.ts", | ||||
|     "qstart-server": "npm run switch-server && npm run start-server", | ||||
|     "start-electron": "npm run prepare-dist && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", | ||||
|     "start-electron-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 electron --inspect=5858 .", | ||||
|     "qstart-electron": "npm run qswitch-electron && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron --inspect=5858 .", | ||||
|     "start-test-server": "npm run qswitch-server; rimraf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 ts-node src/www.ts", | ||||
|     "qstart-electron": "npm run switch-electron && npm run start-electron", | ||||
|     "switch-server": "rimraf ./node_modules/better-sqlite3 && npm install", | ||||
|     "switch-electron": "npx electron-rebuild", | ||||
|     "qswitch-server": "rimraf ./node_modules/better-sqlite3/bin ; mkdir -p ./node_modules/better-sqlite3/build ; cp ./bin/better-sqlite3/linux-server-better_sqlite3.node ./node_modules/better-sqlite3/build/better_sqlite3.node", | ||||
|     "qswitch-electron": "rimraf ./node_modules/better-sqlite3/bin ; mkdir -p ./node_modules/better-sqlite3/build ; cp ./bin/better-sqlite3/linux-desktop-better_sqlite3.node ./node_modules/better-sqlite3/build/better_sqlite3.node", | ||||
|     "build-backend-docs": "rimraf ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", | ||||
|     "build-frontend-docs": "rimraf ./docs/frontend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/basic_widget.js src/public/app/widgets/note_context_aware_widget.js src/public/app/widgets/right_panel_widget.js", | ||||
|     "build-docs": "npm run build-backend-docs && npm run build-frontend-docs", | ||||
|     "webpack": "cross-env NODE_OPTIONS=--loader=ts-node/esm webpack -c webpack.config.ts", | ||||
|     "webpack": "cross-env esrun node_modules/webpack -c webpack.config.ts", | ||||
|     "test-jasmine": "cross-env TRILIUM_DATA_DIR=./data-test tsx ./node_modules/.bin/jasmine", | ||||
|     "test-es6": "tsx -r esm spec-es6/attribute_parser.spec.ts", | ||||
|     "test": "npm run test-jasmine && npm run test-es6", | ||||
| @ -128,7 +126,10 @@ | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@electron-forge/cli": "^6.4.2", | ||||
|     "@electron-forge/maker-deb": "^7.4.0", | ||||
|     "@electron-forge/maker-dmg": "^7.4.0", | ||||
|     "@electron-forge/maker-squirrel": "^6.4.2", | ||||
|     "@electron-forge/maker-zip": "^7.4.0", | ||||
|     "@electron-forge/plugin-auto-unpack-natives": "^6.4.2", | ||||
|     "@playwright/test": "^1.46.0", | ||||
|     "@types/archiver": "^6.0.2", | ||||
| @ -166,6 +167,7 @@ | ||||
|     "electron-packager": "17.1.2", | ||||
|     "electron-rebuild": "3.2.9", | ||||
|     "esm": "3.2.25", | ||||
|     "esrun": "^3.2.26", | ||||
|     "iconsur": "^1.7.0", | ||||
|     "jasmine": "5.1.0", | ||||
|     "jsdoc": "^4.0.3", | ||||
|  | ||||
| @ -48,7 +48,7 @@ app.use(express.static(path.join(scriptDir, 'public/root'))); | ||||
| app.use(`/manifest.webmanifest`, express.static(path.join(scriptDir, 'public/manifest.webmanifest'))); | ||||
| app.use(`/robots.txt`, express.static(path.join(scriptDir, 'public/robots.txt'))); | ||||
| app.use(sessionParser); | ||||
| app.use(favicon(`${scriptDir}/../images/app-icons/win/icon.ico`)); | ||||
| app.use(favicon(`${scriptDir}/../images/app-icons/icon.ico`)); | ||||
| 
 | ||||
| assets.register(app); | ||||
| routes.register(app); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran