Repository navigation
Expand file tree
/
Copy pathelectron-builder-config.js
More file actions
149 lines (139 loc) · 4.66 KB
/
Copy pathelectron-builder-config.js
File metadata and controls
149 lines (139 loc) · 4.66 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
const OS_ARCH_TYPE = {
amd64: 'amd64',
arm64: 'arm64',
};
const getBinariesSupportedSystemArchitecture = () => {
if (process.arch === 'arm64') {
return OS_ARCH_TYPE.arm64;
}
return OS_ARCH_TYPE.amd64;
};
module.exports = () => {
const getExtraFiles = () => {
const currentSystemArch = getBinariesSupportedSystemArchitecture();
let macResourceBinFilter;
switch (currentSystemArch) {
case OS_ARCH_TYPE.arm64:
macResourceBinFilter = [`${OS_ARCH_TYPE.arm64}/**/*`];
break;
case OS_ARCH_TYPE.amd64:
default:
macResourceBinFilter = [
`${OS_ARCH_TYPE.amd64}/**/*`,
`medieval/${OS_ARCH_TYPE.amd64}/**/*`,
];
break;
}
return [
{
from: 'build/mac/bin',
to: 'Resources/bin',
filter: macResourceBinFilter,
},
];
};
// Decides mac.identity below. internals/scripts/AfterPack.js reads that
// value back to tell whether it must ad-hoc sign, so this is the only place
// the signing decision is made.
const hasSigningIdentity = Boolean(
process.env.CSC_LINK ||
process.env.CSC_NAME ||
process.env.CSC_KEY_PASSWORD ||
process.env.APPLEID
);
return {
productName: 'OpenMTP-resume',
appId: 'com.davotoula.openmtp-resume',
// This fork has no Apple Developer ID, so electron-builder finds no signing
// identity and would abort the build here. AfterPack applies an ad-hoc
// signature instead; re-enable this if a real certificate is ever configured.
forceCodeSigning: false,
// eslint-disable-next-line no-template-curly-in-string
artifactName: '${name}-${version}-${os}-${arch}.${ext}',
copyright: '© Ganesh Rathinavel',
afterPack: './internals/scripts/AfterPack.js',
afterSign: './internals/scripts/Notarize.js',
npmRebuild: false,
// Points at this fork so `--publish always` uploads here rather than to the
// upstream repository. The generated app-update.yml is inert while
// auto-update is disabled in main.dev.js, but it should still not advertise
// upstream as this build's update source.
publish: [
{
provider: 'github',
owner: 'davotoula',
repo: 'openmtp',
private: false,
},
],
files: [
'app/dist/',
'app/app.html',
'app/main.prod.js',
'app/main.prod.js.map',
'package.json',
// Ship only the arm64 koffi prebuild: the other 17 add ~25 MB and an x86_64 Mach-O.
'!node_modules/koffi/build/koffi/!(darwin_arm64)/**',
],
extraFiles: getExtraFiles(),
mac: {
type: 'distribution',
icon: 'build/icon.icns',
category: 'public.app-category.productivity',
// forceCodeSigning: false doesn't stop electron-builder from auto-discovering
// whatever identity is in the keychain -- e.g. an "Apple Development" cert,
// which can't sign for distribution and makes codesign fail. Unless a real
// identity is configured, skip signing here and let AfterPack ad-hoc sign.
...(hasSigningIdentity ? {} : { identity: null }),
hardenedRuntime: true,
gatekeeperAssess: false,
// Notarization is done by the afterSign hook (internals/scripts/Notarize.js);
// electron-builder 25+ would otherwise notarize a second time itself.
notarize: false,
entitlements: './build/entitlements.mac.plist',
entitlementsInherit: './build/entitlements.mac.plist',
extendInfo: {
// Electron 45's macOS floor, applied one release early (the epic
// accepts it). Only arm64 builds ship, so this drops Apple Silicon
// Macs still on macOS 11 or 12; without the key electron-builder
// inherits Electron's own floor.
LSMinimumSystemVersion: '13.0',
NSDesktopFolderUsageDescription: 'Desktop folder access',
NSDocumentsFolderUsageDescription: 'Documents folder access',
NSDownloadsFolderUsageDescription: 'Downloads folder access',
NSRemovableVolumesUsageDescription: 'Removable Disk access',
NSPhotoLibraryUsageDescription: 'Photo library access',
},
target: {
target: 'default',
},
},
mas: {
type: 'distribution',
category: 'public.app-category.productivity',
entitlements: 'build/entitlements.mas.plist',
icon: 'build/icon.icns',
},
dmg: {
contents: [
{
x: 130,
y: 220,
},
{
x: 410,
y: 220,
type: 'link',
path: '/Applications',
},
],
},
win: {
target: ['nsis'],
},
linux: {
target: ['deb', 'AppImage'],
category: 'public.app-category.productivity',
},
};
};