Bump Electron to v14 (#1088)

This commit is contained in:
Oscar Hinton 2021-09-28 16:51:53 +02:00 committed by GitHub
parent facedab33c
commit e985018862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2288 additions and 1792 deletions

2
jslib

@ -1 +1 @@
Subproject commit 2c892eb3a2a9aff1e238146b037e6f3eb5dacf9a
Subproject commit cb00604617a3d38fb450d900dbdf63b636ae01f6

4000
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
"sub:pull": "git submodule foreach git pull origin master",
"sub:commit": "npm run sub:pull && git commit -am \"update submodule\"",
"preinstall": "npm run sub:init",
"postinstall": "patch-package && electron-rebuild",
"postinstall": "electron-rebuild",
"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",
@ -73,9 +73,6 @@
"mac": {
"electronUpdaterCompatibility": ">=0.0.1",
"category": "public.app-category.productivity",
"extraFiles": [
"PlugIns/"
],
"darkModeSupport": true,
"gatekeeperAssess": false,
"hardenedRuntime": true,
@ -260,9 +257,9 @@
"cross-env": "^7.0.3",
"css-loader": "^5.2.4",
"del": "^6.0.0",
"electron-builder": "22.10.5",
"electron-notarize": "^1.0.0",
"electron-rebuild": "^2.3.5",
"electron-builder": "22.11.7",
"electron-notarize": "^1.1.1",
"electron-rebuild": "^3.2.3",
"electron-reload": "^1.5.0",
"file-loader": "^6.2.0",
"font-awesome": "4.7.0",
@ -270,7 +267,6 @@
"html-webpack-plugin": "^4.5.1",
"mini-css-extract-plugin": "^1.5.0",
"node-loader": "^1.0.3",
"patch-package": "^6.4.7",
"rimraf": "^3.0.2",
"sass": "^1.32.11",
"sass-loader": "^10.1.1",

View File

@ -1,54 +0,0 @@
diff --git a/node_modules/app-builder-lib/out/macPackager.js b/node_modules/app-builder-lib/out/macPackager.js
index 41e067c..cd97293 100644
--- a/node_modules/app-builder-lib/out/macPackager.js
+++ b/node_modules/app-builder-lib/out/macPackager.js
@@ -292,6 +292,23 @@ 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 rmdir = (0, _fsExtra().remove);
+ try {
+ await rmdir(`${x64AppOutDir}/Bitwarden.app/Contents/PlugIns`, {
+ recursive: true
+ });
+ await rmdir(`${arm64AppOutPath}/Bitwarden.app/Contents/PlugIns`, {
+ recursive: true
+ });
+ } catch (e) {
+ // Catches errors where PlugIns does not exist
+ console.log(e);
+ }
+
const {
makeUniversalApp
} = require('@electron/universal');
@@ -302,7 +319,15 @@ class MacPackager extends _platformPackager().PlatformPackager {
outAppPath: path.join(appOutDir, appFile),
force: true
});
- const rmdir = (0, _util().promisify)(require('fs').rmdir);
+
+ // Bitwarden Patch: Re-add PlugIns dir to Universal binary
+ try {
+ await ((0, _fsExtra().copy)(path.join(this.projectDir, 'PlugIns'), `${path.join(appOutDir, appFile)}/Contents/PlugIns`));
+ } catch (e) {
+ // Catches errors where PlugIns does not exist
+ console.log(e);
+ }
+
await rmdir(x64AppOutDir, {
recursive: true
});
@@ -611,7 +636,7 @@ exports.default = MacPackager;
function getCertificateType(isMas, isDevelopment) {
if (isDevelopment) {
- return "Mac Developer";
+ return "Apple Development";
}
return isMas ? "3rd Party Mac Developer Application" : "Developer ID Application";

View File

@ -1,4 +1,6 @@
require('dotenv').config();
const path = require('path');
const fse = require('fs-extra');
const { notarize } = require('electron-notarize');
exports.default = run;
@ -12,6 +14,16 @@ async function run(context) {
const macBuild = context.electronPlatformName === 'darwin';
if (macBuild) {
// Copy Safari plugin to work-around https://github.com/electron-userland/electron-builder/issues/5552
const plugIn = path.join(__dirname, '../PlugIns');
if (fse.existsSync(plugIn)) {
fse.mkdirSync(path.join(appPath, 'Contents/PlugIns'));
fse.copySync(path.join(plugIn, 'safari.appex'), path.join(appPath, 'Contents/PlugIns/safari.appex'));
// Resign to sign safari extension
await context.packager.signApp(context, true);
}
console.log('### Notarizing ' + appPath);
const appleId = process.env.APPLE_ID_USERNAME || process.env.APPLEID;
const appleIdPassword = process.env.APPLE_ID_PASSWORD || `@keychain:AC_PASSWORD`;