diff options
author | 2022-11-26 05:47:35 +0530 | |
---|---|---|
committer | 2022-11-26 00:17:35 +0000 | |
commit | f60b4f23707e5e0bcd48aab2fe55c75be4ef23d3 (patch) | |
tree | 5c28a5ef979dd1f7530112717ec3e76c0b13dcfc | |
parent | 6.2.1-nightly.51 [skip ci] (diff) | |
download | ferdium-app-f60b4f23707e5e0bcd48aab2fe55c75be4ef23d3.tar.gz ferdium-app-f60b4f23707e5e0bcd48aab2fe55c75be4ef23d3.tar.zst ferdium-app-f60b4f23707e5e0bcd48aab2fe55c75be4ef23d3.zip |
fix sqlite3 issue with electron-rebuild (#800)
-rw-r--r-- | electron-builder-fix-env.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/electron-builder-fix-env.js b/electron-builder-fix-env.js index 1c9a5e495..39c5f142c 100644 --- a/electron-builder-fix-env.js +++ b/electron-builder-fix-env.js | |||
@@ -1,4 +1,28 @@ | |||
1 | // HACKTAG: Fix from https://github.com/electron-userland/electron-builder/issues/7256 to overcome issue from electron-builder for windows multi-arch builds | 1 | const fs = require("fs"); |
2 | const path = require("path"); | ||
2 | exports.default = async function (context) { | 3 | exports.default = async function (context) { |
4 | // HACKTAG: Fix to overcome https://github.com/electron-userland/electron-builder/issues/7256 from electron-builder for windows multi-arch builds | ||
3 | delete process.env.GYP_MSVS_VERSION; | 5 | delete process.env.GYP_MSVS_VERSION; |
6 | |||
7 | // CRAZY HACKTAG: Fix to overcome https://github.com/electron/rebuild/issues/546 from electron-rebuild | ||
8 | /* | ||
9 | 1. Finds sqlite3/package.json | ||
10 | 2. replaces napi_build_version with 6 //current used one | ||
11 | 3. removes napi_versions (if present it expected napi_build_version to be present in modulePath) | ||
12 | */ | ||
13 | const filePath = path.join(process.cwd(), "build", "node_modules", "sqlite3", "package.json"); | ||
14 | |||
15 | //This is to enfore that it happens only during rebuild. | ||
16 | if(fs.existsSync(filePath)) { | ||
17 | const sqlLite = require(filePath); | ||
18 | Object.keys(sqlLite.binary).forEach(key => { | ||
19 | let value = sqlLite.binary[key]; | ||
20 | if(typeof value === 'string') { | ||
21 | value = value.replace("{napi_build_version}", 6) | ||
22 | sqlLite.binary[key] = value | ||
23 | } | ||
24 | }) | ||
25 | delete sqlLite.binary["napi_versions"] | ||
26 | fs.writeFileSync(filePath, JSON.stringify(sqlLite)) | ||
27 | } | ||
4 | }; | 28 | }; |