-
-
Notifications
You must be signed in to change notification settings - Fork 196
/
electron-builder.config.js
148 lines (142 loc) · 4.08 KB
/
electron-builder.config.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
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
const { Arch } = require('electron-builder');
let shouldNotarize = process.platform === 'darwin';
if (shouldNotarize) {
if (!process.env.APPLE_TEAM_ID) {
shouldNotarize = false;
console.warn('No APPLE_TEAM_ID environment variable set, notarization will be skipped');
}
if (!process.env.APPLE_ID) {
shouldNotarize = false;
console.warn('No APPLE_ID environment variable set, notarization will be skipped');
}
if (!process.env.APPLE_APP_SPECIFIC_PASSWORD) {
shouldNotarize = false;
console.warn('No APPLE_APP_SPECIFIC_PASSWORD environment variable set, notarization will be skipped');
}
}
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const config = {
appId: 'com.akiver.csdm',
copyright: 'Copyright © 2014-present AkiVer',
productName: 'CS Demo Manager',
publish: {
provider: 'github',
},
fileAssociations: {
ext: 'dem',
name: 'DEM',
description: 'CS demo file',
role: 'Viewer',
},
win: {
target: {
target: 'nsis',
arch: ['x64'],
},
executableName: 'cs-demo-manager',
extraFiles: [
{
from: 'build-assets/bin/csdm.cmd',
to: './csdm.cmd',
},
],
extraResources: [
{
from: './static',
to: 'static',
filter: ['!**/*.so', '!**/*.dylib'],
},
],
},
mac: {
target: [
{
target: 'dmg',
arch: ['x64', 'arm64'],
},
{
// It's important to also generate zip files otherwise the auto-update will fail.
// See https://github.com/electron-userland/electron-builder/issues/6058
target: 'zip',
arch: ['x64', 'arm64'],
},
],
category: 'public.app-category.developer-tools',
appId: 'com.akiver.csdm',
notarize: shouldNotarize
? {
teamId: process.env.APPLE_TEAM_ID,
}
: false,
extraResources: [
// From https://developer.apple.com/forums/thread/128166
// > IMPORTANT Scripts are not considered code.
// > If you have scripts — shell, Python, AppleScript, or whatever — place them in the resources directory.
// > These will still be signed, but as a resource rather than as code.
//
// Trying with extraFiles would result in the following error as it's considered as nested code:
// Command failed: codesign --sign XXX --force --timestamp ./dist/mac-arm64/CS Demo Manager.app/Contents/MacOS/CS Demo Manager
// ./dist/mac-arm64/CS Demo Manager.app/Contents/MacOS/CS Demo Manager: replacing existing signature
// ./dist/mac-arm64/CS Demo Manager.app/Contents/MacOS/CS Demo Manager: code object is not signed at all
// In subcomponent: ./dist/mac-arm64/CS Demo Manager.app/Contents/csdm
{
from: 'build-assets/bin/csdm_darwin.sh',
to: './csdm',
},
{
from: './static',
to: 'static',
filter: ['!**/*.dll', '!**/*.exe', '!**/*.so'],
},
],
},
linux: {
executableName: 'cs-demo-manager',
target: [
{ target: 'deb', arch: ['x64'] },
{ target: 'rpm', arch: ['x64'] },
{ target: 'AppImage', arch: ['x64'] },
],
icon: 'build-assets/icon.icns',
extraFiles: [
{
from: 'build-assets/bin/csdm.sh',
to: './csdm',
},
],
extraResources: [
{
from: './static',
to: 'static',
filter: ['!**/*.dll', '!**/*.exe', '!**/*.dylib'],
},
],
},
directories: {
output: 'dist',
buildResources: 'build-assets',
},
files: [
'package.json',
{
from: 'out',
to: '.',
},
],
beforePack: async (context) => {
const { installBoilerWritter, installCounterStrikeVoiceExtractor, installDemoAnalyzer } = await import(
'./scripts/install-deps.mjs'
);
const arch = Arch[context.arch];
const platform = context.packager.platform.nodeName;
await Promise.all([
installDemoAnalyzer(platform, arch),
installBoilerWritter(platform, arch),
installCounterStrikeVoiceExtractor(platform),
]);
},
};
module.exports = config;