-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathelectron-builder.config.cjs
More file actions
150 lines (145 loc) · 4.91 KB
/
Copy pathelectron-builder.config.cjs
File metadata and controls
150 lines (145 loc) · 4.91 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
const path = require('path');
const { getBuilderExtraResources, packageAfterCopy } = require('./scripts/electron-package-hooks.cjs');
const APP_SHORT_DESCRIPTION = 'A modern digital radio station for amateur radio operators.';
const APP_LONG_DESCRIPTION = 'A modern digital radio station for amateur radio operators. Operate FT8, FT4, and voice modes from any web browser - anywhere, anytime.';
const LINUX_DEB_DEPENDS = [
'libgtk-3-0',
'libnotify4',
'libnss3',
'xdg-utils',
'libatspi2.0-0',
'libdrm2',
'libgbm1',
'libxcb-dri3-0',
'kde-cli-tools | kde-runtime | trash-cli | libglib2.0-bin | gvfs-bin',
];
function normalizeBuilderArch(value) {
if (typeof value === 'string') return value;
const archNames = { 0: 'ia32', 1: 'x64', 2: 'armv7l', 3: 'arm64', 4: 'universal' };
return archNames[value] || process.env.ARCH || process.arch;
}
function sanitizeMacIdentity(value) {
return String(value || '')
.trim()
.replace(/^Developer ID Application:\s*/i, '')
|| undefined;
}
function resolveBuilderPackagePaths(context) {
const productFilename = context.packager.appInfo.productFilename || 'TX-5DR';
if (context.electronPlatformName === 'darwin') {
const resourcesDir = path.join(context.appOutDir, `${productFilename}.app`, 'Contents', 'Resources');
return { appRoot: path.join(resourcesDir, 'app'), resourcesDir };
}
const resourcesDir = path.join(context.appOutDir, 'resources');
return { appRoot: path.join(resourcesDir, 'app'), resourcesDir };
}
module.exports = {
appId: 'com.tx5dr.app',
productName: 'TX-5DR',
executableName: 'tx-5dr',
artifactName: 'TX-5DR-${version}-${os}-${arch}.${ext}',
directories: {
output: 'out/electron-builder',
buildResources: 'packages/electron-main/assets',
},
files: [
'package.json',
'packages/**/package.json',
'packages/**/dist/**',
'packages/client-tools/src/proxy.js',
'packages/electron-main/assets/**',
'node_modules/**',
'!node_modules/.cache/**',
'!**/*.map',
'!**/test/**',
'!**/tests/**',
'!**/*.ts',
],
extraResources: getBuilderExtraResources(),
asar: false,
npmRebuild: false,
publish: [{ provider: 'generic', url: 'https://tx5dr.com/updates' }],
afterPack: async (context) => {
const { appRoot, resourcesDir } = resolveBuilderPackagePaths(context);
await packageAfterCopy({
appRoot,
resourcesDir,
platform: context.electronPlatformName,
arch: normalizeBuilderArch(context.arch),
});
},
mac: {
category: 'public.app-category.utilities',
icon: path.join(__dirname, 'packages/electron-main/assets/AppIcon.icns'),
target: ['dmg', 'zip'],
artifactName: 'TX-5DR-${version}-macos-${arch}.${ext}',
hardenedRuntime: true,
entitlements: 'build/entitlements.mac.plist',
entitlementsInherit: 'build/entitlements.mac.plist',
identity: sanitizeMacIdentity(process.env.APPLE_IDENTITY),
notarize: Boolean(
process.env.APPLE_ID
&& process.env.APPLE_APP_SPECIFIC_PASSWORD
&& process.env.APPLE_TEAM_ID
),
},
win: {
icon: path.join(__dirname, 'packages/electron-main/assets/AppIcon.ico'),
target: ['nsis', 'zip', '7z'],
artifactName: 'TX-5DR-${version}-windows-${arch}.${ext}',
requestedExecutionLevel: 'asInvoker',
compression: 'normal',
},
nsis: {
artifactName: 'TX-5DR-${version}-windows-${arch}-nsis.${ext}',
oneClick: false,
perMachine: false,
allowElevation: false,
allowToChangeInstallationDirectory: true,
createDesktopShortcut: true,
createStartMenuShortcut: true,
shortcutName: 'TX-5DR',
uninstallDisplayName: 'TX-5DR',
deleteAppDataOnUninstall: false,
differentialPackage: true,
runAfterFinish: true,
},
linux: {
icon: path.join(__dirname, 'packages/electron-main/assets/AppIcon.png'),
category: 'Utility;AudioVideo',
packageCategory: 'utils',
target: ['AppImage', 'deb', 'rpm', 'zip'],
artifactName: 'TX-5DR-${version}-linux-${arch}.${ext}',
maintainer: 'BG5DRB <bg5drb@example.com>',
vendor: 'TX-5DR Team',
synopsis: APP_SHORT_DESCRIPTION,
// electron-builder derives desktop Comment from linux.description after entry overrides.
description: APP_SHORT_DESCRIPTION,
desktop: {
entry: {
Name: 'tx-5dr',
Comment: APP_LONG_DESCRIPTION,
GenericName: 'Ham Radio Application',
StartupNotify: 'true',
},
},
},
appImage: {
artifactName: 'TX-5DR-${version}-linux-${arch}.${ext}',
},
deb: {
packageName: 'tx-5dr',
priority: 'optional',
packageCategory: 'utils',
description: APP_LONG_DESCRIPTION,
depends: LINUX_DEB_DEPENDS,
recommends: ['pulseaudio | libasound2'],
fpm: ['--deb-suggests', 'gir1.2-gnomekeyring-1.0', '--deb-suggests', 'libgnome-keyring0', '--deb-suggests', 'lsb-release'],
},
rpm: {
packageName: 'tx-5dr',
packageCategory: 'utils',
synopsis: APP_SHORT_DESCRIPTION,
description: APP_LONG_DESCRIPTION,
},
};