This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
electron-builder.js
84 lines (77 loc) · 1.97 KB
/
electron-builder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright © 2022 The Radicle Upstream Contributors
//
// This file is part of radicle-upstream, distributed under the GPLv3
// with Radicle Linking Exception. For full terms see the included
// LICENSE file.
module.exports = {
appId: "xyz.radicle.radicle-upstream",
artifactName: "${name}.${ext}",
afterSign: notarizeApp,
files: [
"public/**/*",
"native/bundle.js",
"native/bundle.js.map",
"native/bundle.licenses.txt",
"native/preload.js",
],
directories: {
buildResources: "public",
},
extraResources: [
...rustBinaryResources(["upstream-proxy", "git-remote-rad", "upstream"]),
{
from: "upstream-proxy/assets",
to: "assets",
},
],
protocols: [
{
name: "radicle",
schemes: ["radicle"],
},
],
linux: {
target: ["Appimage"],
},
mac: {
target: ["dmg"],
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: "builder/entitlements.mac.plist",
entitlementsInherit: "builder/entitlements.mac.plist",
minimumSystemVersion: "10.14",
},
};
function rustBinaryResources(binNames) {
const ext = process.platform === "win32" ? ".exe" : "";
return binNames.map(binName => ({
from: `target/release/${binName}${ext}`,
to: "./",
}));
}
async function notarizeApp(context) {
if (process.env.NOTARIZE !== "true") {
return;
}
if (context.electronPlatformName !== "darwin") {
throw new Error("Notarization must be performad on macOS!");
}
if (
!(
process.env.APPLE_ID &&
process.env.APPLE_ID_PASSWORD &&
process.env.CSC_NAME
)
) {
throw new Error(
"APPLE_ID, APPLE_ID_PASSWORD and CSC_NAME env variables must be set!"
);
}
const { notarize } = await import("electron-notarize");
await notarize({
appBundleId: context.appId,
appPath: `${context.appOutDir}/${context.packager.appInfo.productFilename}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
});
}