-
Notifications
You must be signed in to change notification settings - Fork 0
/
forge.config.ts
executable file
·169 lines (165 loc) · 6.06 KB
/
forge.config.ts
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
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv").config({ path: ['.env', '.env.default'] });
import { AutoUnpackNativesPlugin } from "@electron-forge/plugin-auto-unpack-natives";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { WebpackPlugin } from "@electron-forge/plugin-webpack";
import type { ForgeConfig } from "@electron-forge/shared-types";
import { getAppTransportSecuity, getExtraResource, getIco, getIcon, getName, isBetaRelease } from "./src/utils/config";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
import { mainConfig } from "./webpack.main.config";
import { rendererConfig } from "./webpack.renderer.config";
import pkg from "./package.json";
let currentArch = "";
const config: ForgeConfig = {
hooks: {
generateAssets: async (_x, _y, arch) => {
if (arch === "all") {
currentArch = "universal";
return;
}
currentArch = arch;
},
},
packagerConfig: {
icon: `${__dirname}/assets/icons/${getIcon()}`,
asar: true,
name: getName(),
executableName: getName(),
extraResource: getExtraResource(),
appVersion: pkg.version,
appCopyright: pkg.config.copyright,
// Required for macOS mailto protocol
protocols: [
{
name: "mailto",
schemes: ["mailto"],
},
],
// Change category type of the application on macOS
appCategoryType: "public.app-category.productivity",
appBundleId: pkg.config.appBundleId,
osxSign: {},
osxNotarize: {
appleId: process.env.APPLE_ID!,
appleIdPassword: process.env.APPLE_PASSWORD!,
teamId: process.env.APPLE_TEAM_ID!,
},
extendInfo: {
...getAppTransportSecuity(),
},
},
rebuildConfig: {},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "proton_mail", // Avoids clash with ProtonMail folder used by Bridge in appData
iconUrl: `${__dirname}/assets/icons/${getIco()}`,
setupIcon: `${__dirname}/assets/icons/${getIco()}`,
loadingGif: `${__dirname}/assets/windows/install-spinner.gif`,
signWithParams: process.env.WINDOWS_PACKAGE_SIGNING === 'yes' ? `/a /d "Proton Mail Desktop" /t "http://timestamp.sectigo.com" /fd SHA256` : undefined,
},
},
{
name: "@electron-forge/maker-dmg",
config: {
background: `${__dirname}/assets/macos/background.png`,
icon: `${__dirname}/assets/macos/volume.icns`,
contents: () => {
return [
{
x: 229,
y: 250,
type: "file",
path: `${process.cwd()}/out/${getName()}-darwin-${currentArch}/${getName()}.app`,
},
{ x: 429, y: 250, type: "link", path: "/Applications" },
];
},
additionalDMGOptions: {
window: {
size: {
width: 658,
height: 490,
},
},
},
},
},
{
name: "@electron-forge/maker-rpm",
config: {
options: {
bin: getName(),
icon: `${__dirname}/assets/linux/${getIcon()}.svg`,
homepage: pkg.author.url,
categories: ["Network", "Email"],
mimeType: ["x-scheme-handler/mailto"],
},
},
},
{
name: "@electron-forge/maker-deb",
config: {
options: {
bin: getName(),
icon: `${__dirname}/assets/linux/${getIcon()}.svg`,
maintainer: pkg.author.name,
homepage: pkg.author.url,
categories: ["Network", "Email"],
mimeType: ["x-scheme-handler/mailto"],
},
},
},
{
name: "@electron-forge/maker-zip",
platforms: ["win32", "darwin", "linux"],
config: {},
},
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
prerelase: isBetaRelease,
repository: {
owner: pkg.config.githubUser,
name: pkg.config.githubRepo,
},
},
},
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
html: "./src/index.html",
js: "./src/renderer.ts",
name: "main_window",
preload: {
js: "./src/preload.ts",
},
},
],
},
}),
new FusesPlugin({
version: FuseVersion.V1,
// Disables ELECTRON_RUN_AS_NODE
[FuseV1Options.RunAsNode]: false,
// Disables the NODE_OPTIONS environment variable
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
// Disables the --inspect and --inspect-brk family of CLI options
[FuseV1Options.EnableNodeCliInspectArguments]: false,
// Enables validation of the app.asar archive on macOS
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
// Enforces that Electron will only load your app from "app.asar" instead of its normal search paths
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};
export default config;