diff --git a/.dockerignore b/.dockerignore index 786c22ff9..a4e242a99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,7 +5,6 @@ .prettier* electron* entitlements.plist -forge.config.cjs nodemon.json renovate.json trilium.iml @@ -34,4 +33,10 @@ npm-debug.log # exceptions -!/bin/copy-dist.ts \ No newline at end of file +!/bin/copy-dist.ts + +# temporary exception to make copy-dist inside Docker build not fail +# TriliumNextTODO: make copy-dist *not* requiring to copy this file for builds other than electron-forge +!forge.config.cjs +!/bin/tpl +!/bin/electron-forge/desktop.ejs \ No newline at end of file diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index b5a140efc..51b022bed 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -97,7 +97,7 @@ runs: shell: bash run: | echo "Signing DMG file..." - dmg_file=$(find out -name "*.dmg" -print -quit) + dmg_file=$(find ./dist -name "*.dmg" -print -quit) if [ -n "$dmg_file" ]; then echo "Found DMG: $dmg_file" # Get the first valid signing identity from the keychain @@ -125,7 +125,7 @@ runs: # First check the .app bundle echo "Looking for .app bundle..." - app_bundle=$(find out -name "*.app" -print -quit) + app_bundle=$(find ./dist -name "*.app" -print -quit) if [ -n "$app_bundle" ]; then echo "Found app bundle: $app_bundle" echo "Verifying app bundle signing..." @@ -144,7 +144,7 @@ runs: # Then check DMG if it exists echo "Looking for DMG..." - dmg_file=$(find out -name "*.dmg" -print -quit) + dmg_file=$(find ./dist -name "*.dmg" -print -quit) if [ -n "$dmg_file" ]; then echo "Found DMG: $dmg_file" echo "Verifying DMG signing..." @@ -160,7 +160,7 @@ runs: # Finally check ZIP if it exists echo "Looking for ZIP..." - zip_file=$(find out -name "*.zip" -print -quit) + zip_file=$(find ./dist -name "*.zip" -print -quit) if [ -n "$zip_file" ]; then echo "Found ZIP: $zip_file" echo "Note: ZIP files are not code signed, but their contents should be" @@ -177,7 +177,7 @@ runs: # Look for DMG files recursively echo "Looking for DMG files..." - dmg_file=$(find out -name "*.dmg" -print -quit) + dmg_file=$(find ./dist -name "*.dmg" -print -quit) if [ -n "$dmg_file" ]; then echo "Found DMG: $dmg_file" cp "$dmg_file" "upload/TriliumNextNotes-${{ github.ref_name }}-macos-${{ inputs.arch }}.dmg" @@ -187,7 +187,7 @@ runs: # Look for ZIP files recursively echo "Looking for ZIP files..." - zip_file=$(find out -name "*.zip" -print -quit) + zip_file=$(find ./dist -name "*.zip" -print -quit) if [ -n "$zip_file" ]; then echo "Found ZIP: $zip_file" cp "$zip_file" "upload/TriliumNextNotes-${{ github.ref_name }}-macos-${{ inputs.arch }}.zip" @@ -199,7 +199,7 @@ runs: echo "Collecting artifacts for ${{ inputs.os }}..." for ext in ${{ inputs.extension }}; do echo "Looking for .$ext files..." - file=$(find out -name "*.$ext" -print -quit) + file=$(find ./dist -name "*.$ext" -print -quit) if [ -n "$file" ]; then echo "Found $file for extension $ext" cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.$ext" diff --git a/bin/copy-dist.ts b/bin/copy-dist.ts index 03b0c751b..b3f79ad56 100644 --- a/bin/copy-dist.ts +++ b/bin/copy-dist.ts @@ -30,6 +30,9 @@ try { "./package.json", "./LICENSE", "./README.md", + "./forge.config.cjs", + "./bin/tpl/", + "./bin/electron-forge/desktop.ejs", "./src/views/", "./src/etapi/etapi.openapi.yaml", "./src/routes/api/openapi.json", diff --git a/forge.config.cjs b/forge.config.cjs index b2b72c4d0..dabcd7ca4 100644 --- a/forge.config.cjs +++ b/forge.config.cjs @@ -11,6 +11,9 @@ const baseLinuxMakerConfigOptions = { }; module.exports = { + // we run electron-forge inside the ./build folder, + // to have it output to ./dist, we need to go up a directory first + outDir: "../dist", packagerConfig: { executableName: "trilium", name: APP_NAME, @@ -130,7 +133,7 @@ module.exports = { }; function getExtraResourcesForPlatform() { - const resources = ["./bin/tpl/anonymize-database.sql"]; + const resources = []; const getScriptRessources = () => { const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"]; diff --git a/package.json b/package.json index 5bd779ee4..ee1fd5356 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Build your personal knowledge base with TriliumNext Notes", "version": "0.92.3-beta", "license": "AGPL-3.0-only", - "main": "./build/electron-main.js", + "main": "./electron-main.js", "author": { "name": "TriliumNext Notes Team", "email": "contact@eliandoran.me", @@ -38,9 +38,10 @@ "electron:switch": "electron-rebuild", "docs:edit": "cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data-docs TRILIUM_ENV=dev TRILIUM_PORT=37741 electron ./electron-docs-main.ts .", "docs:edit-nix": "electron-rebuild --version 33.3.1 && cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data-docs TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_PORT=37741 TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./electron-docs-main.ts .\"", - "electron-forge:start": "npm run build:prepare-dist && electron-forge start", - "electron-forge:make": "npm run build:prepare-dist && electron-forge make", - "electron-forge:package": "npm run build:prepare-dist && electron-forge package", + "electron-forge:prepare": "npm run build:prepare-dist && cp -r node_modules ./build", + "electron-forge:start": "npm run electron-forge:prepare && cd ./build && electron-forge start", + "electron-forge:make": "npm run electron-forge:prepare && cd ./build && electron-forge make", + "electron-forge:package": "npm run electron-forge:prepare && cd ./build && electron-forge package", "docs:build-backend": "rimraf ./docs/backend_api && typedoc ./docs/backend_api src/becca/entities/*.ts src/services/backend_script_api.ts src/services/sql.ts", "docs:build-frontend": "rimraf ./docs/frontend_api && 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", "docs:build": "npm run docs:build-backend && npm run docs:build-frontend",