From 603d8f0e7ea3f034b827ab8807cd40750526dd25 Mon Sep 17 00:00:00 2001 From: roberto Date: Tue, 3 Mar 2026 17:21:00 +0100 Subject: [PATCH] refactor: update native module handling for Windows and Linux in build process --- .gitea/workflows/build.yaml | 22 +++++++++++++++------- forge.config.ts | 4 +++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 99aa58b..3597c8b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -26,9 +26,6 @@ jobs: - name: Set version from tag run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version --allow-same-version - - name: Rebuild native modules for Linux - run: npx --yes @electron/rebuild --platform=linux --arch=x64 - - name: Make App (Linux) run: npm run make -- --platform=linux --arch=x64 @@ -40,10 +37,21 @@ jobs: env: WINEDEBUG: '-all' - - name: Rebuild native modules for Windows - run: npx --yes @electron/rebuild --platform=win32 --arch=x64 --only=better-sqlite3,keytar - env: - WINEDEBUG: '-all' + - name: Download Windows prebuilt native modules + shell: bash + run: | + ELECTRON_VERSION=$(node -e "console.log(require('electron/package.json').version)") + echo "Downloading prebuilt native modules for Electron ${ELECTRON_VERSION} (win32/x64)..." + + # better-sqlite3 + cd node_modules/better-sqlite3 + npx --yes prebuild-install -r electron -t ${ELECTRON_VERSION} --platform win32 --arch x64 --verbose + cd ../.. + + # keytar + cd node_modules/keytar + npx --yes prebuild-install -r electron -t ${ELECTRON_VERSION} --platform win32 --arch x64 --verbose || echo "keytar prebuilt not available, skipping" + cd ../.. - name: Make App (Windows) run: npm run make -- --platform=win32 --arch=x64 diff --git a/forge.config.ts b/forge.config.ts index 8e9e0e7..2654b89 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -10,7 +10,9 @@ import { FuseV1Options, FuseVersion } from '@electron/fuses'; const config: ForgeConfig = { packagerConfig: { - asar: true, + asar: { + unpack: '**/node_modules/{better-sqlite3,keytar}/**', + }, name: 'adiuva', }, rebuildConfig: {},