-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathelectron-builder.ts
More file actions
119 lines (112 loc) · 2.78 KB
/
electron-builder.ts
File metadata and controls
119 lines (112 loc) · 2.78 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import { execSync } from "node:child_process";
import { Arch, Configuration, Platform } from "electron-builder";
const files = ["!*", "!node_modules/**/*", "ts-out", "package.json", "LICENSE"];
export const config: Configuration = {
artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
nsis: {
include: "build/installer.nsh",
artifactName: "${productName} Setup ${arch}.${ext}",
},
appId: "io.github.milkshiift.GoofCord",
productName: "GoofCord",
files: files,
linux: {
icon: "assets/gf_icon.icns",
category: "Network",
maintainer: "MilkShift",
target: [
{
target: "AppImage",
arch: ["x64", "arm64", "armv7l"],
},
],
desktop: {
entry: {
Name: "GoofCord",
GenericName: "Internet Messenger",
Type: "Application",
Categories: "Network;InstantMessaging;Chat;",
Keywords: "discord;goofcord;",
},
},
files: [...files, "!ts-out/native/*-win32-*.node"],
},
win: {
icon: "assets/gf_icon.ico",
target: [
{
target: "NSIS",
arch: ["x64", "ia32", "arm64"],
},
],
files: [...files, "!ts-out/native/*-linux-*.node"],
},
mac: {
category: "public.app-category.social-networking",
target: [
{
target: "dmg",
arch: ["x64", "arm64"],
},
],
icon: "assets/gf_icon.icns",
darkModeSupport: true,
identity: "",
entitlements: "build/entitlements.mac.plist",
entitlementsInherit: "build/entitlements.mac.plist",
extendInfo: {
NSMicrophoneUsageDescription: "This app needs access to the microphone",
NSCameraUsageDescription: "This app needs access to the camera",
"com.apple.security.device.audio-input": true,
"com.apple.security.device.camera": true,
},
files: [...files, "!ts-out/native/*-linux-*.node", "!ts-out/native/*-win32-*.node"],
},
electronFuses: {
runAsNode: false,
onlyLoadAppFromAsar: true,
},
electronLanguages: ["en-US"],
extraResources: [
{
from: "assets/native/patchcord-linux-${arch}",
to: "patchcord",
filter: ["**/*"],
},
],
beforePack: async (context) => {
const currentArch = getArchString(context.arch);
const currentPlatform = getPlatformString(context.packager.platform);
const output = execSync(`bun run build --skipTypecheck --platform=${currentPlatform} --arch=${currentArch}`, {
encoding: "utf-8",
});
console.log(output);
},
};
function getPlatformString(platform: Platform): string {
switch (platform) {
case Platform.WINDOWS:
return "win32";
case Platform.LINUX:
return "linux";
case Platform.MAC:
return "darwin";
default:
return "unknown";
}
}
function getArchString(arch: Arch): string {
switch (arch) {
case Arch.x64:
return "x64";
case Arch.arm64:
return "arm64";
case Arch.ia32:
return "ia32";
case Arch.armv7l:
return "armv7l";
default:
return "unknown";
}
}
export default config;