mirror of
https://github.com/actualbudget/actual.git
synced 2026-10-12 02:10:19 +00:00
:electron: Fix "Unknown problem opening <local actual file>" on Electron (#3220)
* add electron logging to main browser process console * add logging * removing old way * release notes * adding some logs in to test mac build * repent satan * i caste yeee oooott sinner * derp * hmmm< * forcing nodegyprebuild * not like this.... Not like this... 😢 * hmm * dunno * will it recognise it if i link it manually.. 👀 * give up * rebuild * merge asars fasle * update package * manually do it ffs work damnit * remove the cmd * dont rebuild cause i build it manually * dafuq is this, two bettersqlite modules installed huhhhhh * test * does this work? * bloody hell * couple more logs * test this out * arch in name * adding the rebuild step back into first build * try rebuild before pack - so we know what arch we need * having a laugh * tidying up * release notes * move package up a bit * exit process if no electron verison
This commit is contained in:
@@ -34,8 +34,6 @@ if [ "$OSTYPE" == "msys" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
yarn rebuild-electron
|
||||
|
||||
yarn workspace loot-core build:node
|
||||
|
||||
yarn workspace @actual-app/web build --mode=desktop
|
||||
@@ -50,10 +48,10 @@ yarn workspace desktop-electron update-client
|
||||
if [ -f ../../.secret-tokens ]; then
|
||||
source ../../.secret-tokens
|
||||
fi
|
||||
yarn build --publish never --arm64 --x64
|
||||
yarn build
|
||||
|
||||
echo "\nCreated release"
|
||||
else
|
||||
SKIP_NOTARIZATION=true yarn build --publish never --x64
|
||||
SKIP_NOTARIZATION=true yarn build
|
||||
fi
|
||||
)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { rebuild } from '@electron/rebuild';
|
||||
import { Arch, AfterPackContext } from 'electron-builder';
|
||||
|
||||
/* The beforePackHook runs before packing the Electron app for an architecture
|
||||
We hook in here to build anything architecture dependent - such as beter-sqlite3
|
||||
To build, we call @electron/rebuild on the better-sqlite3 module */
|
||||
const beforePackHook = async (context: AfterPackContext) => {
|
||||
const arch: string = Arch[context.arch];
|
||||
const buildPath = context.packager.projectDir;
|
||||
const projectRootPath = buildPath + '/../../';
|
||||
const electronVersion = context.packager.config.electronVersion;
|
||||
|
||||
if (!electronVersion) {
|
||||
console.error('beforePackHook: Unable to find electron version.');
|
||||
process.exit(); // End the process - electron version is required
|
||||
}
|
||||
|
||||
try {
|
||||
await rebuild({
|
||||
arch,
|
||||
buildPath,
|
||||
electronVersion,
|
||||
force: true,
|
||||
projectRootPath,
|
||||
onlyModules: ['better-sqlite3'],
|
||||
});
|
||||
|
||||
console.info(`Rebuilt better-sqlite3 with ${arch}!`);
|
||||
} catch (err) {
|
||||
console.error('beforePackHook:', err);
|
||||
process.exit(); // End the process - unsuccessful build
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line import/no-unused-modules, import/no-default-export
|
||||
export default beforePackHook;
|
||||
@@ -24,26 +24,22 @@
|
||||
"!node_modules/better-sqlite3/{benchmark,src,bin,docs,deps,build/Release/obj,build/Release/sqlite3.a,build/Release/test_extension.node}",
|
||||
"build"
|
||||
],
|
||||
"publish": {
|
||||
"provider": "github",
|
||||
"repo": "actual",
|
||||
"owner": "actualbudget",
|
||||
"vPrefixedTagName": true
|
||||
},
|
||||
"beforePack": "./build/beforePackHook.js",
|
||||
"mac": {
|
||||
"category": "public.app-category.finance",
|
||||
"icon": "icons/icon.icns",
|
||||
"hardenedRuntime": true,
|
||||
"gatekeeperAssess": false,
|
||||
"artifactName": "${productName}-mac.${ext}",
|
||||
"artifactName": "${productName}-mac-${arch}.${ext}",
|
||||
"notarize": {
|
||||
"teamId": "79ANZ983YF"
|
||||
},
|
||||
"target": [
|
||||
{
|
||||
"target": "default",
|
||||
"target": "dmg",
|
||||
"arch": [
|
||||
"universal"
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -63,7 +59,8 @@
|
||||
"target": "nsis",
|
||||
"icon": "icons/icon.ico",
|
||||
"artifactName": "${productName}-windows.${ext}"
|
||||
}
|
||||
},
|
||||
"npmRebuild": false
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-is-dev": "2.0.0",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [MikesGlitch]
|
||||
---
|
||||
|
||||
Fix electron builds throwing "We had an unknown problem opening file"
|
||||
|
||||
Reference in New Issue
Block a user