-
Notifications
You must be signed in to change notification settings - Fork 71
/
electron-builder.js
125 lines (118 loc) · 2.64 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
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
/* eslint-disable @typescript-eslint/no-var-requires */
const deepMerge = require('deepmerge');
const packageJson = require('./package.json');
const network = process.env.STX_NETWORK || 'testnet';
if (!network) throw new Error('Must define STX_NETWORK environment variable');
if (!['mainnet', 'testnet'].includes(process.env.STX_NETWORK)) {
console.warn('You have no set a `STX_NETWORK` env var, defaulting to testnet');
}
const baseConfig = {
afterSign: 'scripts/notarize.js',
asarUnpack: ['**/*.node'],
files: [
'dist/',
'node_modules/',
'resources/',
'app.html',
'main.prod.js',
'main.prod.js.map',
'preload.js',
'package.json',
],
nsis: {
perMachine: true,
oneClick: false,
allowToChangeInstallationDirectory: true,
},
dmg: {
contents: [
{
x: 130,
y: 220,
},
{
x: 410,
y: 220,
type: 'link',
path: '/Applications',
},
],
},
win: {
verifyUpdateCodeSignature: false,
// Don't use `msi` installer issues
target: [
{
target: 'nsis',
arch: ['x64', 'ia32'],
},
],
extraFiles: [
{
from: './resources/libusbK.dll',
to: '.',
},
],
publisherName: 'Leather Wallet, LLC',
},
mac: {
hardenedRuntime: true,
category: 'public.app-category.finance',
entitlements: 'resources/entitlements.mac.plist',
entitlementsInherit: 'resources/entitlements.mac.plist',
darkModeSupport: true,
},
linux: {
target: ['deb', 'rpm'],
category: 'Finance',
},
directories: {
buildResources: 'resources',
output: 'release',
},
extraMetadata: {
version: packageJson.version,
},
};
const networkConfigs = {
testnet: {
productName: 'Leather Testnet',
appId: 'so.hiro.StacksWalletTestnet',
artifactName: 'leather-wallet.testnet.${ext}',
mac: {
icon: 'icon.testnet.icns',
},
win: {
icon: 'icon.testnet.ico',
},
linux: {
icon: 'icons-testnet',
},
// macos `Application Support` dir name
extraMetadata: {
name: 'leather-wallet-testnet',
productName: 'Leather Testnet',
},
},
mainnet: {
productName: 'Leather',
appId: 'so.hiro.StacksWallet',
icon: 'icon-512x512.png',
artifactName: 'leather-wallet.mainnet.${ext}',
mac: {
icon: 'icon.icns',
},
win: {
icon: 'icon.mainnet.ico',
},
linux: {
icon: 'icons-mainnet',
},
extraMetadata: {
name: 'leather-wallet',
productName: 'Leather',
},
},
};
const mergedConfig = deepMerge(baseConfig, networkConfigs[network]);
module.exports = mergedConfig;