Merge pull request #3174 from balena-io/electron9-2

Electron v9.0.0
This commit is contained in:
bulldozer-balena[bot] 2020-05-25 17:33:56 +00:00 committed by GitHub
commit 3d855dcbfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 209 additions and 572 deletions

View File

@ -9,6 +9,7 @@
"libgtk-3-0", "libgtk-3-0",
"libatk-bridge2.0-0", "libatk-bridge2.0-0",
"libdbus-1-3", "libdbus-1-3",
"libgbm1",
"libc6" "libc6"
] ]
}, },

View File

@ -162,7 +162,7 @@ lint-spell:
lint: lint-ts lint-sass lint-cpp lint-spell lint: lint-ts lint-sass lint-cpp lint-spell
MOCHA_OPTIONS=--recursive --reporter spec --require ts-node/register MOCHA_OPTIONS=--recursive --reporter spec --require ts-node/register --require-main "tests/gui/allow-renderer-process-reuse.ts"
# See https://github.com/electron/spectron/issues/127 # See https://github.com/electron/spectron/issues/127
ETCHER_SPECTRON_ENTRYPOINT ?= $(shell node -e 'console.log(require("electron"))') ETCHER_SPECTRON_ENTRYPOINT ?= $(shell node -e 'console.log(require("electron"))')

View File

@ -63,6 +63,7 @@ deb:
- libexpat1 - libexpat1
- libfontconfig1 - libfontconfig1
- libfreetype6 - libfreetype6
- libgbm1
- libgcc1 - libgcc1
- libgconf-2-4 - libgconf-2-4
- libgdk-pixbuf2.0-0 - libgdk-pixbuf2.0-0

View File

@ -83,6 +83,7 @@ async function createMainWindow() {
nodeIntegration: true, nodeIntegration: true,
webviewTag: true, webviewTag: true,
zoomFactor: width / defaultWidth, zoomFactor: width / defaultWidth,
enableRemoteModule: true,
}, },
}); });
@ -134,6 +135,7 @@ async function createMainWindow() {
}); });
} }
electron.app.allowRendererProcessReuse = false;
electron.app.on('window-all-closed', electron.app.quit); electron.app.on('window-all-closed', electron.app.quit);
// Sending a `SIGINT` (e.g: Ctrl-C) to an Electron app that registers // Sending a `SIGINT` (e.g: Ctrl-C) to an Electron app that registers

View File

@ -18,7 +18,6 @@ import * as _ from 'lodash';
import * as prettyBytes from 'pretty-bytes'; import * as prettyBytes from 'pretty-bytes';
const MEGABYTE_TO_BYTE_RATIO = 1000000; const MEGABYTE_TO_BYTE_RATIO = 1000000;
const MILLISECONDS_IN_A_DAY = 86400000;
export function bytesToMegabytes(bytes: number): number { export function bytesToMegabytes(bytes: number): number {
return bytes / MEGABYTE_TO_BYTE_RATIO; return bytes / MEGABYTE_TO_BYTE_RATIO;
@ -30,7 +29,3 @@ export function bytesToClosestUnit(bytes: number): string | null {
} }
return null; return null;
} }
export function daysToMilliseconds(days: number): number {
return days * MILLISECONDS_IN_A_DAY;
}

711
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,7 @@
"@types/request": "^2.48.4", "@types/request": "^2.48.4",
"@types/semver": "^7.1.0", "@types/semver": "^7.1.0",
"@types/sinon": "^9.0.0", "@types/sinon": "^9.0.0",
"@types/terser-webpack-plugin": "^2.2.0",
"@types/tmp": "^0.2.0", "@types/tmp": "^0.2.0",
"@types/webpack-node-externals": "^1.7.0", "@types/webpack-node-externals": "^1.7.0",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
@ -68,12 +69,12 @@
"copy-webpack-plugin": "^6.0.1", "copy-webpack-plugin": "^6.0.1",
"css-loader": "^3.5.3", "css-loader": "^3.5.3",
"d3": "^4.13.0", "d3": "^4.13.0",
"debug": "^4.1.1", "debug": "^4.2.0",
"electron": "7.1.14", "electron": "9.0.0",
"electron-builder": "^22.1.0", "electron-builder": "^22.6.1",
"electron-mocha": "^8.2.0", "electron-mocha": "^8.2.0",
"electron-notarize": "^0.3.0", "electron-notarize": "^0.3.0",
"electron-updater": "^4.3.1", "electron-updater": "^4.3.2",
"etcher-sdk": "^4.1.3", "etcher-sdk": "^4.1.3",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"flexboxgrid": "^6.3.0", "flexboxgrid": "^6.3.0",
@ -95,7 +96,7 @@
"react": "^16.8.5", "react": "^16.8.5",
"react-dom": "^16.8.5", "react-dom": "^16.8.5",
"redux": "^4.0.5", "redux": "^4.0.5",
"rendition": "^14.11.5", "rendition": "^14.11.6",
"request": "^2.81.0", "request": "^2.81.0",
"resin-corvus": "^2.0.5", "resin-corvus": "^2.0.5",
"roboto-fontface": "^0.10.0", "roboto-fontface": "^0.10.0",
@ -105,17 +106,17 @@
"semver": "^7.3.2", "semver": "^7.3.2",
"simple-progress-webpack-plugin": "^1.1.2", "simple-progress-webpack-plugin": "^1.1.2",
"sinon": "^9.0.2", "sinon": "^9.0.2",
"spectron": "^9.0.0", "spectron": "^11.0.0",
"string-replace-loader": "^2.3.0", "string-replace-loader": "^2.3.0",
"styled-components": "^5.1.0", "styled-components": "^5.1.0",
"styled-system": "^5.1.5", "styled-system": "^5.1.5",
"sudo-prompt": "^9.0.0", "sudo-prompt": "^9.0.0",
"sys-class-rgb-led": "^2.1.0", "sys-class-rgb-led": "^2.1.0",
"tmp": "^0.2.1", "tmp": "^0.2.1",
"ts-loader": "^7.0.4", "ts-loader": "^7.0.5",
"ts-node": "^8.3.0", "ts-node": "^8.3.0",
"typescript": "^3.5.3", "typescript": "^3.5.3",
"uuid": "^8.0.0", "uuid": "^8.1.0",
"webpack": "^4.40.2", "webpack": "^4.40.2",
"webpack-cli": "^3.3.9" "webpack-cli": "^3.3.9"
} }

View File

@ -0,0 +1,22 @@
diff --git a/node_modules/app-builder-lib/electron-osx-sign/sign.js b/node_modules/app-builder-lib/electron-osx-sign/sign.js
index 3b85d83c..87da4e57 100644
--- a/node_modules/app-builder-lib/electron-osx-sign/sign.js
+++ b/node_modules/app-builder-lib/electron-osx-sign/sign.js
@@ -119,6 +119,17 @@ async function verifySignApplicationAsync (opts) {
function signApplicationAsync (opts) {
return walkAsync(getAppContentsPath(opts))
.then(async function (childPaths) {
+ /**
+ * Sort the child paths by how deep they are in the file tree. Some arcane apple
+ * logic expects the deeper files to be signed first otherwise strange errors get
+ * thrown our way
+ */
+ childPaths = childPaths.sort((a, b) => {
+ const aDepth = a.split(path.sep).length
+ const bDepth = b.split(path.sep).length
+ return bDepth - aDepth
+ })
+
function ignoreFilePath (opts, filePath) {
if (opts.ignore) {
return opts.ignore.some(function (ignore) {

View File

@ -0,0 +1,3 @@
// tslint:disable-next-line:no-var-requires
const { app } = require('electron');
app.allowRendererProcessReuse = false;

View File

@ -23,6 +23,7 @@ import * as os from 'os';
import outdent from 'outdent'; import outdent from 'outdent';
import * as path from 'path'; import * as path from 'path';
import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin';
import * as TerserPlugin from 'terser-webpack-plugin';
import { BannerPlugin } from 'webpack'; import { BannerPlugin } from 'webpack';
/** /**
@ -102,7 +103,21 @@ function replace(test: RegExp, ...replacements: ReplacementRule[]) {
const commonConfig = { const commonConfig = {
mode: 'production', mode: 'production',
optimization: { optimization: {
minimize: false, minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: false,
mangle: false,
output: {
beautify: true,
comments: false,
ecma: 2018,
},
},
extractComments: false,
}),
],
}, },
module: { module: {
rules: [ rules: [