-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathforge.config.js
More file actions
207 lines (205 loc) · 6.78 KB
/
forge.config.js
File metadata and controls
207 lines (205 loc) · 6.78 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
const fs = require("fs")
const path = require("path")
require("dotenv").config()
const AdmZip = require("adm-zip")
module.exports = {
packagerConfig: {
icon: path.resolve(__dirname, "static/icons/icon"),
appBundleId: "org.polinetwork.webeep-sync",
osxSign: {
identity:
process.env.MACOS_IDENTITY ||
"Developer ID Application: PoliNetwork APS (842636PS9J)",
"hardened-runtime": true,
entitlements: "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library",
"gatekeeper-assess": false,
},
osxNotarize: {
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEPWD,
teamId: process.env.TEAMID,
ascProvider: process.env.TEAMID,
},
},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "webeep-sync",
setupIcon: "./static/icons/icon.ico",
setupExe: "WeBeep Sync Windows Setup.exe",
loadingGif: "./static/icons/loading.gif",
},
},
{
name: "@electron-forge/maker-zip",
platforms: ["darwin"],
},
{
name: "@electron-forge/maker-dmg",
config: arch => {
return {
name: `WeBeep Sync macOS-${arch}`,
format: "ULFO",
overwrite: true,
background: path.resolve(__dirname, "static/dmg/[email protected]"),
icon: path.resolve(__dirname, "static/dmg/icon.icns"),
contents: [
{
path: path.resolve(
__dirname,
`out/WeBeep Sync-darwin-${arch}/WeBeep Sync.app`
),
type: "file",
x: 120,
y: 90,
},
{
path: "/Applications",
type: "link",
x: 380,
y: 90,
},
],
additionalDMGOptions: {
window: { size: { height: 200, width: 500 } },
},
platforms: ["darwin"],
}
},
},
{
name: "@electron-forge/maker-deb",
config: {
bin: "WeBeep Sync",
name: "webeep-sync",
productName: "WeBeep Sync",
description: "Keep all your WeBeep files synced on your computer!",
productDescription:
"Keep all your WeBeep files synced on your computer!",
categories: ["Utility"],
// According to the documentation of @electron-forge/maker-deb `icon` should be a single file path,
// however this config option gets passed straight to the electron-installer-debian package,
// wich says in its documentation that multiple icons sizes are allowed.
icon: {
"32x32": "./static/icons/icon-32x32.png",
"48x48": "./static/icons/icon-48x48.png",
"64x64": "./static/icons/icon-64x64.png",
"72x72": "./static/icons/icon-72x72.png",
"80x80": "./static/icons/icon-80x80.png",
"96x96": "./static/icons/icon-96x96.png",
"128x128": "./static/icons/icon-128x128.png",
"256x256": "./static/icons/icon-256x256.png",
},
},
},
{
name: "@electron-forge/maker-rpm",
config: {
bin: "WeBeep Sync",
name: "webeep-sync",
productName: "WeBeep Sync",
description: "Keep all your WeBeep files synced on your computer!",
productDescription:
"Keep all your WeBeep files synced on your computer!",
categories: ["Utility"],
// According to the documentation of @electron-forge/maker-rpm icon should be a single file path,
// however this config option gets passed straight to the electron-installer-redhat package,
// wich says in its documentation that multiple icons sizes are allowed.
icon: {
"32x32": "./static/icons/icon-32x32.png",
"48x48": "./static/icons/icon-48x48.png",
"64x64": "./static/icons/icon-64x64.png",
"72x72": "./static/icons/icon-72x72.png",
"80x80": "./static/icons/icon-80x80.png",
"96x96": "./static/icons/icon-96x96.png",
"128x128": "./static/icons/icon-128x128.png",
"256x256": "./static/icons/icon-256x256.png",
},
},
},
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
repository: {
name: "webeep-sync",
owner: "toto04",
},
prerelease: !!process.env.PRERELEASE,
draft: true,
},
},
],
plugins: [
{
name: "@electron-forge/plugin-webpack",
config: {
mainConfig: "./webpack.main.config.js",
renderer: {
config: "./webpack.renderer.config.js",
entryPoints: [
{
name: "main_window",
html: "./src/index.html",
js: "./src/renderer.ts",
name: "main_window",
},
],
},
},
},
],
hooks: {
postMake: (_config, makeResults) => {
// this hook is here to zip the .exe installer, because windows doesnt trust when you
// download an unsigned .exe from the internet, but it's ok if you unzip it first
let winRelease = makeResults.find(m => m.platform === "win32")
if (winRelease) {
let zipPath // will be set to the .zip file, will be used for new artifact array
console.log("Zipping exe installer...")
winRelease.artifacts.forEach(art => {
if (art.endsWith(".exe")) {
zipPath = art.slice(0, -3) + "zip"
const zip = new AdmZip()
zip.addFile(path.basename(art), fs.readFileSync(art))
fs.writeFileSync(zipPath, zip.toBuffer())
}
})
winRelease.artifacts.push(zipPath)
}
const linuxReleases = makeResults.filter(m => m.platform === "linux")
if (linuxReleases.length) {
// rename the .deb and .rpm files to remove the version number
console.log("Renaming linux packages...")
console.log("linuxRelease.artifacts: ", linuxReleases)
linuxReleases.forEach(release => {
release.artifacts.forEach((art, i) => {
if (art.endsWith(".deb")) {
const newName = path.resolve(
path.dirname(art),
"webeep-sync-debian.deb"
)
console.log(`Renaming ${art} to ${newName}`)
fs.renameSync(art, newName)
release.artifacts[i] = newName
}
if (art.endsWith(".rpm")) {
const newName = path.resolve(
path.dirname(art),
"webeep-sync-redhat.rpm"
)
console.log(`Renaming ${art} to ${newName}`)
fs.renameSync(art, newName)
release.artifacts[i] = newName
}
})
})
}
return makeResults
},
},
}