Skip to content

Commit 0dcbb20

Browse files
chore: Update electron and related dependencies (#7675)
* update electorn dependencies * bring back electron updated patch * lock * simplify notorization * attempt to fix lock file --------- Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
1 parent 44cd6bd commit 0dcbb20

File tree

6 files changed

+149
-613
lines changed

6 files changed

+149
-613
lines changed

packages/desktop/electron-builder-config.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const notarize = require('./scripts/notarize.macos.js')
1+
const getNotarizeOptions = require('./scripts/notarize.macos.js')
22
const merge = require('lodash.merge')
33
const { STAGE, getAppName, APP_ID, APP_PROTOCOL, CHANNEL_NAME, APP_ARTIFACT } = require('./product.js')
44

@@ -9,15 +9,6 @@ const prodConfig = () => ({
99
directories: { buildResources: './public', output: './out' },
1010
files: ['public/', 'package.json', '!node_modules/@iota/sdk/target/*'],
1111
appId: APP_ID,
12-
afterSign: async () => {
13-
// eslint-disable-next-line no-useless-catch
14-
try {
15-
await notarize(getAppName())
16-
} catch (err) {
17-
// This catch is necessary or the promise rejection is swallowed
18-
throw err
19-
}
20-
},
2112
asar: true,
2213
protocols: [{ name: `${getAppName()} URL Scheme`, schemes: [APP_PROTOCOL] }],
2314
dmg: {
@@ -63,6 +54,7 @@ const prodConfig = () => ({
6354
hardenedRuntime: true,
6455
gatekeeperAssess: false,
6556
asarUnpack: ['**/*.node'],
57+
notarize: getNotarizeOptions(),
6658
},
6759
publish: {
6860
provider: 'generic',

packages/desktop/electron/main.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -357,18 +357,19 @@ app.on('window-all-closed', () => {
357357
}
358358
})
359359

360-
powerMonitor.on('suspend', () => {
361-
// MacOS, Windows and Linux
362-
windows.main?.webContents?.send('power-monitor-suspend')
363-
})
360+
app.once('ready', () => {
361+
powerMonitor.on('suspend', () => {
362+
// MacOS, Windows and Linux
363+
windows.main?.webContents?.send('power-monitor-suspend')
364+
})
364365

365-
powerMonitor.on('lock-screen', () => {
366-
// MacOS and Windows
367-
windows.main?.webContents?.send('power-monitor-lock-screen')
368-
})
366+
powerMonitor.on('lock-screen', () => {
367+
// MacOS and Windows
368+
windows.main?.webContents?.send('power-monitor-lock-screen')
369+
})
369370

370-
app.once('ready', () => {
371371
ipcMain.handle('error-data', () => lastError)
372+
372373
app.on('activate', () => {
373374
// On macOS it's common to re-create a window in the app when the
374375
// dock icon is clicked and there are no other windows open.

packages/desktop/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"@sentry/electron": "^4.10.0",
3333
"@types/webpack-dev-server": "^4.7.2",
3434
"dotenv": "^16.0.3",
35-
"electron-dl": "^3.5.0",
36-
"electron-log": "^4.3.1",
37-
"electron-updater": "5.3.0",
35+
"electron-dl": "^3.5.1",
36+
"electron-log": "^4.4.8",
37+
"electron-updater": "6.1.4",
3838
"https-browserify": "^1.0.0",
3939
"keytar": "^7.9.0",
4040
"node-machine-id": "^1.1.12",
@@ -43,14 +43,13 @@
4343
},
4444
"devDependencies": {
4545
"@sentry/webpack-plugin": "^2.8.0",
46-
"@electron/notarize": "^2.1.0",
4746
"@tsconfig/svelte": "^4.0.1",
4847
"@types/webpack": "^5.28.1",
4948
"copy-webpack-plugin": "^11.0.0",
5049
"cross-env": "^7.0.2",
5150
"css-loader": "^6.7.3",
52-
"electron": "22.3.27",
53-
"electron-builder": "^24.0.0",
51+
"electron": "27.0.2",
52+
"electron-builder": "^24.6.4",
5453
"esbuild-loader": "^4.0.2",
5554
"lodash.merge": "^4.6.2",
5655
"mini-css-extract-plugin": "^2.7.6",

packages/desktop/scripts/notarize.macos.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { notarize } = require('@electron/notarize')
21
const path = require('path')
32

43
/**
@@ -8,7 +7,7 @@ const path = require('path')
87
*/
98
module.exports = async (appName) => {
109
if (process.platform !== 'darwin' || process.env.MACOS_SKIP_NOTARIZATION) {
11-
return true
10+
return undefined
1211
}
1312

1413
const APPLE_ID = process.env.FIREFLY_APPLE_ID
@@ -22,10 +21,10 @@ module.exports = async (appName) => {
2221
throw Error('Notarization failed: Environment variable "FIREFLY_APPLE_ID_PASSWORD" is not defined')
2322
}
2423

25-
await notarize({
24+
return {
2625
appPath: path.resolve(__dirname, `../out/mac/${appName}.app`),
2726
appleId: APPLE_ID,
2827
appleIdPassword: APPLE_ID_PASSWORD,
2928
teamId: 'UG77RJKZHH',
30-
})
29+
}
3130
}

patches/electron-updater+5.3.0.patch patches/electron-updater+6.1.4.patch

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
diff --git a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
2-
index 9d35ee9..ea445aa 100644
2+
index a12ba9f..cd2f090 100644
33
--- a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
44
+++ b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
5-
@@ -43,8 +43,7 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
5+
@@ -37,8 +37,7 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
66
try {
77
if (error != null || stderr) {
8-
handleError(logger, error, stderr);
8+
handleError(logger, error, stderr, reject);
99
- resolve(null);
1010
- return;
1111
+ throw error;
1212
}
13-
const data = parseOut(Buffer.from(stdout, "base64").toString("utf-8"));
13+
const data = parseOut(stdout);
1414
if (data.Status === 0) {
15-
@@ -75,8 +74,8 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
15+
@@ -69,8 +68,8 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
1616
}
1717
catch (e) {
18-
handleError(logger, e, null);
18+
handleError(logger, e, null, reject);
1919
- resolve(null);
2020
- return;
2121
+ logger.warn(`Cannot execute Get-AuthenticodeSignature: ${e}. Aborting update.`);

0 commit comments

Comments
 (0)