-
Notifications
You must be signed in to change notification settings - Fork 6
/
packager.js
50 lines (48 loc) · 1.52 KB
/
packager.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
const { spawnSync } = require("child_process");
const sevenBin = require("7zip-bin");
const packager = require("electron-packager");
const { glob } = require("glob");
(async () => {
const buildFiles = new Set([
"",
"/package.json",
"/build",
...(await glob("build/prod/**", { posix: true })).map((path) => `/${path}`),
]);
const output = await packager({
arch: process.env.PACKAGER_ARCH,
dir: ".",
extraResource: ["extraResources"],
ignore: (path) => !buildFiles.has(path),
out: "dist",
overwrite: true,
...(process.platform === "darwin" && {
appBundleId: "party.karafriends",
icon: "appIcons/icon.icns",
osxNotarize: {
tool: "notarytool",
appleApiKey: process.env.NOTARIZATION_KEY_PATH,
appleApiKeyId: "Z4H7RZ6QUT",
appleApiIssuer: "69a6de70-1249-47e3-e053-5b8c7c11a4d1",
},
osxSign: {
identity: "Developer ID Application: Connor Worley (WZ6JC3T383)",
// yt-dlp needs to load python dylibs we don't have control over
optionsForFile: (path) =>
path.endsWith("/yt-dlp_macos")
? {
entitlements: [
"com.apple.security.cs.disable-library-validation",
],
}
: {},
},
}),
...(process.platform === "win32" && {
icon: "appIcons/icon.ico",
}),
});
console.log(`Built ${output}. Zipping...`);
spawnSync(sevenBin.path7za, ["a", "-r", `${output}.zip`, output]);
console.log(`Built ${output}.zip.`);
})();