forked from notion-enhancer/notion-repackaged
-
Notifications
You must be signed in to change notification settings - Fork 0
/
electron-builder.js
92 lines (84 loc) · 2.47 KB
/
electron-builder.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
function ensureEnvVar(envVarName) {
if (!(envVarName in process.env)) {
throw new Error(`Missing environment variable ${envVarName}`);
}
return process.env[envVarName];
}
const editionEnvVar = ensureEnvVar('NOTION_REPACKAGED_EDITION'),
versionEnvVar = ensureEnvVar('NOTION_VERSION'),
revisionEnvVar = ensureEnvVar('NOTION_REPACKAGED_REVISION');
const isVanilla = editionEnvVar === 'vanilla';
const productName = isVanilla ? 'Notion' : 'Notion Enhanced',
productId = isVanilla ? 'notion-app' : 'notion-app-enhanced',
conflictProductId = !isVanilla ? 'notion-app' : 'notion-app-enhanced',
productDescription = isVanilla
? 'The all-in-one workspace for your notes and tasks'
: 'The all-in-one workspace for your notes and tasks, but enhanced';
const fpmOptions = [
`--version=${versionEnvVar}`,
`--iteration=${revisionEnvVar}`,
`--conflicts=${conflictProductId}`,
];
const combineTargetAndArch = (targets, architectures = ['x64', 'arm64']) =>
targets.map((target) => ({ target, arch: architectures }));
// realistically Auto Update only works for Windows
const getPublishProviders = (platform) => [
{
provider: 'github',
publishAutoUpdate: platform === 'win',
},
];
module.exports = {
asar: true,
productName: productName,
extraMetadata: {
description: productDescription,
},
appId: 'com.github.notion-repackaged',
protocols: [{ name: 'Notion', schemes: ['notion'] }],
win: {
icon: 'icon.ico',
target: combineTargetAndArch(['nsis', 'zip'], ['x64']),
publish: getPublishProviders('win'),
},
mac: {
icon: 'icon.icns',
category: 'public.app-category.productivity',
target: combineTargetAndArch(['dmg', 'zip']),
publish: getPublishProviders('mac'),
},
linux: {
icon: 'icon.icns',
category: 'Office;Utility;',
maintainer: '[email protected]',
mimeTypes: ['x-scheme-handler/notion'],
desktop: {
StartupNotify: 'true',
StartupWMClass: productId,
},
target: combineTargetAndArch(['AppImage', 'deb', 'rpm', 'pacman', 'zip']),
publish: getPublishProviders('linux'),
},
nsis: {
installerIcon: 'icon.ico',
oneClick: false,
perMachine: false,
},
deb: {
fpm: fpmOptions,
depends: [
'libgtk-3-0',
'libnotify4',
'libnss3',
'libxss1',
'libxtst6',
'xdg-utils',
'libatspi2.0-0',
'libuuid1',
'libsecret-1-0',
/* 'libappindicator3-1', */
],
},
pacman: { fpm: fpmOptions },
rpm: { fpm: fpmOptions },
};