Skip to content

Commit 33aa835

Browse files
authored
Fix INS-2242, add afterPack workaround for electron-builder (#5627)
1 parent a410dfd commit 33aa835

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

packages/insomnia/electron-builder.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const config = {
2626
],
2727
publish: null,
2828
afterSign: './scripts/afterSignHook.js',
29+
afterPack: './scripts/afterPack.js',
2930
extraResources: [
3031
{
3132
from: './bin',
@@ -43,6 +44,8 @@ const config = {
4344
},
4445
fileAssociations: [],
4546
mac: {
47+
// disabling notarize on electron-builder, we use afterSignHook.js
48+
notarize: false,
4649
hardenedRuntime: true,
4750
category: 'public.app-category.developer-tools',
4851
entitlements: './build/static/entitlements.mac.inherit.plist',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Remove these hacks when this bug is fixed
2+
* https://github.com/electron-userland/electron-builder/issues/7317
3+
* Adapted from https://github.com/electron-userland/electron-builder/issues/7317#issuecomment-1351168459
4+
*/
5+
6+
exports.default = async function patchSign(context) {
7+
if (context.electronPlatformName !== 'darwin') {
8+
return;
9+
}
10+
const asoSave = context.packager.adjustSignOptions;
11+
if (asoSave.patched) {
12+
return;
13+
}
14+
console.log('[afterpack] Applying adjustSignOptions hack, see electron-userland/electron-builder#7317');
15+
context.packager.adjustSignOptions = async function(signOptions, masOptions) {
16+
await asoSave.call(this, signOptions, masOptions);
17+
if (typeof signOptions.identity === 'object' && signOptions.identity.name) {
18+
console.warn('[afterpack] Applying signOptions hack for signing identity.');
19+
signOptions.identity = signOptions.identity.name;
20+
}
21+
if (signOptions['identity-validation'] !== undefined) {
22+
console.warn('[afterpack] Applying identity validation hack.');
23+
signOptions.identityValidation = signOptions['identity-validation'];
24+
delete signOptions['identity-validation'];
25+
}
26+
};
27+
context.packager.adjustSignOptions.patched = true;
28+
};

0 commit comments

Comments
 (0)