-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathforge.config.js
More file actions
167 lines (152 loc) · 4.4 KB
/
forge.config.js
File metadata and controls
167 lines (152 loc) · 4.4 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
const path = require('path')
const fs = require('fs')
// Taken over from https://github.com/electron/fiddle/blob/main/forge.config.js
if (process.env.WINDOWS_CODESIGN_FILE) {
const certPath = path.join(__dirname, 'win-certificate.pfx')
const certExists = fs.existsSync(certPath)
if (certExists) {
process.env.WINDOWS_CODESIGN_FILE = certPath
}
}
const iconPath = path.resolve(__dirname, 'assets', 'icon')
const { devDependencies = {}, dependencies = {} } = JSON.parse(
fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'),
)
const devOnlyDeps = new Set(Object.keys(devDependencies).filter(pkg => !(pkg in dependencies)))
const config = {
packagerConfig: {
icon: iconPath,
executableName: 'swarm-desktop',
name: 'Swarm Desktop',
appBundleId: 'org.ethswarm.swarmDesktop',
asar: true,
ignore: [
// UI source + its node_modules — compiled output is already in dist/ui
/^\/ui\//,
// TypeScript source files — compiled output is in dist/desktop/
// Note: only .ts files are excluded; static assets (HTML, CSS, audio) under
// src/plugins/ must remain so plugin BrowserWindows can load them at runtime
// via app.getAppPath() + 'src/plugins/...'
/^\/src\/.*\.ts$/,
// Test files
/^\/test\//,
// Dev config and tooling files
/^\/.github/,
/^\/.husky/,
/^\/.depcheckrc\.json$/,
/^\/.editorconfig$/,
/^\/.gitattributes$/,
/^\/.gitignore$/,
/^\/.nvmrc$/,
/^\/.prettierignore$/,
/^\/.prettierrc$/,
/^\/.release-please-manifest\.json$/,
/^\/release-please-config\.json$/,
/^\/commitlint\.config\.cjs$/,
/^\/devkit\.mjs$/,
/^\/eslint-compat\.cjs$/,
/^\/eslint\.config\.mjs$/,
/^\/forge\.config\.js$/,
/^\/jest\.config\.ts$/,
/^\/tsconfig.*\.json$/,
/^\/CHANGELOG\.md$/,
/^\/CODEOWNERS$/,
/^\/CODE_OF_CONDUCT\.md$/,
/^\/README\.md$/,
// Build caches
/^\/node_modules\/\.cache\//,
// DevDependency node_modules — derived dynamically from package.json devDependencies
filePath => {
const match = filePath.match(/^\/node_modules\/((?:@[^/]+\/[^/]+)|[^/]+)/)
return match ? devOnlyDeps.has(match[1]) : false
},
],
osxSign: {
identity: 'Developer ID Application: Swarm Association (9J9SPHU9RP)',
hardenedRuntime: true,
'gatekeeper-assess': false,
entitlements: 'assets/entitlements.plist',
'entitlements-inherit': 'assets/entitlements.plist',
},
},
electronInstallerDebian: {
bin: 'Swarm Desktop',
},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
name: 'swarm-desktop',
iconUrl: iconPath + '.ico',
setupIcon: iconPath + '.ico',
loadingGif: path.resolve(__dirname, 'assets', 'windows-install.gif'),
certificateFile: process.env.WINDOWS_CODESIGN_FILE,
certificatePassword: process.env.WINDOWS_CODESIGN_PASSWORD,
},
},
{
name: '@electron-forge/maker-dmg',
config: {
icon: `${iconPath}.icns`,
format: 'ULFO',
},
},
{
name: '@electron-forge/maker-deb',
config: {
options: {
icon: `${iconPath}.png`,
},
},
},
{
name: '@electron-forge/maker-rpm',
config: {
options: {
icon: `${iconPath}.png`,
},
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin', 'win32'],
config: {},
},
],
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'ethersphere',
name: 'swarm-desktop',
},
prerelease: true,
draft: false,
},
},
],
}
function notarizeMaybe() {
if (process.platform !== 'darwin') {
return
}
if (!process.env.CI) {
console.log(`Not in CI, skipping notarization`)
return
}
if (!process.env.APPLE_ID || !process.env.APPLE_ID_PASSWORD) {
console.warn('Should be notarizing, but environment variables APPLE_ID or APPLE_ID_PASSWORD are missing!')
return
}
config.packagerConfig.osxNotarize = {
tool: 'notarytool',
appBundleId: 'org.ethswarm.swarmDesktop',
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
ascProvider: '9J9SPHU9RP',
teamId: '9J9SPHU9RP',
}
}
notarizeMaybe()
module.exports = config