forked from pkgxdev/ossapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
electron-builder.config.cjs
84 lines (78 loc) · 1.99 KB
/
electron-builder.config.cjs
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
const { notarize } = require("@electron/notarize");
const fs = require("fs");
const path = require("path");
const _ = require("lodash");
const appBundleId = "xyz.tea.gui";
module.exports = {
appId: appBundleId,
productName: "ossapp",
asar: false,
directories: { output: "dist" },
files: ["electron/dist/electron.cjs", { from: "svelte/build", to: "" }],
linux: {
icon: "./icon.png"
},
mac: {
icon: "./electron/icon.icns",
target: {
target: process.env.MAC_BUILD_TARGET || "default",
arch: ["x64", "arm64"]
},
minimumSystemVersion: "11"
},
dmg: {
// background: "./electron/bg.png",
window: {
width: 684,
height: 465
},
iconSize: 128,
contents: [
{
x: 158,
y: 219
},
{
x: 528,
y: 219,
type: "link",
path: "/Applications"
}
]
},
afterSign: async (params) => {
const shouldNotarize =
process.env.NOTARIZE === "true" || process.env.CSC_IDENTITY_AUTO_DISCOVERY === "true";
if (process.platform !== "darwin" || !shouldNotarize) {
console.log("not notarizing app");
return;
}
console.log("afterSign hook triggered");
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
console.log("skip");
return;
}
console.log(
`Notarizing ${appBundleId} found at ${appPath} with Apple ID ${process.env.APPLE_ID}`
);
try {
await notarize({
tool: "notarytool",
appBundleId,
appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
teamId: process.env.APPLE_TEAM_ID
});
} catch (error) {
console.error(error);
}
console.log(`Done notarizing`);
},
// this determines the configuration of the auto-update feature
publish: {
provider: "generic",
url: process.env.PUBLISH_URL || "https://gui.pkgx.dev/release"
}
};