Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
Patch electron-builder to support universal binaries on Mac (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton authored Mar 22, 2021
1 parent 619cf40 commit 29c1007
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 1 deletion.
204 changes: 204 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"sub:update": "git submodule update --remote",
"sub:pull": "git submodule foreach git pull origin master",
"sub:commit": "npm run sub:pull && git commit -am \"update submodule\"",
"postinstall": "./node_modules/.bin/electron-rebuild && npm run sub:init",
"postinstall": "./node_modules/.bin/electron-rebuild && npm run sub:init && patch-package",
"symlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
"symlink:mac": "npm run symlink:lin",
"symlink:lin": "rm -rf ./jslib && ln -s ../jslib ./jslib",
Expand Down Expand Up @@ -278,6 +278,7 @@
"node-abi": "^2.9.0",
"node-loader": "^0.6.0",
"node-sass": "^4.13.1",
"patch-package": "^6.4.7",
"rimraf": "^2.6.2",
"sass-loader": "^7.1.0",
"ts-loader": "^8.0.2",
Expand Down
34 changes: 34 additions & 0 deletions patches/app-builder-lib+22.10.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/node_modules/app-builder-lib/out/macPackager.js b/node_modules/app-builder-lib/out/macPackager.js
index 41e067c..0607d09 100644
--- a/node_modules/app-builder-lib/out/macPackager.js
+++ b/node_modules/app-builder-lib/out/macPackager.js
@@ -292,6 +292,18 @@ class MacPackager extends _platformPackager().PlatformPackager {

const appFile = `${this.appInfo.productFilename}.app`;

+ // Bitwarden Patch: Electron-Builder currently does not support including our Safari extension which
+ // is already cross-compiled. Hence we remove it prior to making the universal package, and re-add
+ // it afterwards
+ // https://github.com/electron-userland/electron-builder/issues/5552
+ const rmdir2 = (0, _util().promisify)(require('fs').rmdir);
+ await rmdir2(`${x64AppOutDir}/Bitwarden.app/Contents/PlugIns`, {
+ recursive: true
+ });
+ await rmdir2(`${arm64AppOutPath}/Bitwarden.app/Contents/PlugIns`, {
+ recursive: true
+ });
+
const {
makeUniversalApp
} = require('@electron/universal');
@@ -302,6 +314,10 @@ class MacPackager extends _platformPackager().PlatformPackager {
outAppPath: path.join(appOutDir, appFile),
force: true
});
+
+ // Bitwarden Patch: Re-add PlugIns dir to Universal binary
+ await ((0, _fsExtra().copy)(path.join(this.projectDir, 'PlugIns'), `${path.join(appOutDir, appFile)}/Contents/PlugIns`));
+
const rmdir = (0, _util().promisify)(require('fs').rmdir);
await rmdir(x64AppOutDir, {
recursive: true

0 comments on commit 29c1007

Please sign in to comment.