-
Notifications
You must be signed in to change notification settings - Fork 11
/
forge.config.ts
148 lines (140 loc) · 4.26 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
import { MakerDMG } from '@electron-forge/maker-dmg';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import type { ForgeConfig } from '@electron-forge/shared-types';
import 'dotenv/config';
import fs from 'fs';
import path from 'path';
import packageConfig from './package.json';
import { mainConfig } from './webpack.main.config';
import { rendererConfig } from './webpack.renderer.config';
const ASSETS_DIR = path.join(__dirname, 'src', 'assets');
const config: ForgeConfig = {
packagerConfig: {
asar: true,
afterCopyExtraResources: [
(buildPath, electronVersion, platform, arch, callback) => {
if (platform === 'win32') {
fs.renameSync(
`${buildPath}/resources/algod`,
`${buildPath}/resources/algod.exe`,
);
fs.renameSync(
`${buildPath}/resources/goal`,
`${buildPath}/resources/goal.exe`,
);
fs.renameSync(
`${buildPath}/resources/kmd`,
`${buildPath}/resources/kmd.exe`,
);
}
callback();
},
],
beforeCopyExtraResources: [
(buildPath, electronVersion, platform, arch, callback) => {
const suffix = platform === 'win32' ? '.exe' : '';
const algod = `algod${suffix}`;
const goal = `goal${suffix}`;
const kmd = `kmd${suffix}`;
try {
// delete the packaged directory if it exists
if (fs.existsSync('src/bin/packaged')) {
fs.rmdirSync('src/bin/packaged', { recursive: true });
}
// copy the platform binaries to the packaged directory
fs.mkdirSync('src/bin/packaged');
fs.copyFileSync(
`src/bin/${platform}/${algod}`,
`src/bin/packaged/algod`,
);
fs.copyFileSync(
`src/bin/${platform}/${goal}`,
`src/bin/packaged/goal`,
);
fs.copyFileSync(`src/bin/${platform}/${kmd}`, `src/bin/packaged/kmd`);
callback();
} catch (err) {
callback(err);
}
},
],
executableName: packageConfig.name,
extraResource: [
'src/assets/icons/icon.icns',
'src/assets/icons/icon.ico',
'src/assets/icons/icon.png',
'src/bin/packaged/algod',
'src/bin/packaged/goal',
'src/bin/packaged/kmd',
'src/config/algorand.mainnet.genesis.json',
'src/config/algorand.mainnet.config.json',
'src/config/voi.mainnet.genesis.json',
'src/config/voi.mainnet.config.json',
],
icon: path.join(ASSETS_DIR, 'icons', 'icon'),
osxNotarize: {
appleId: process.env.APPLE_ID!,
appleIdPassword: process.env.APPLE_PASSWORD!,
teamId: process.env.APPLE_TEAM_ID!,
tool: 'notarytool',
},
osxSign: {},
},
rebuildConfig: {},
makers: [
// MakerDeb class was having issues, so use raw object format
{
name: '@electron-forge/maker-deb',
config: {
icon: path.join(ASSETS_DIR, 'icons', 'icon.png'),
},
},
new MakerDMG({
icon: path.join(ASSETS_DIR, 'icons', 'icon.icns'),
name: 'Austs One-Click Node',
overwrite: true,
}),
new MakerSquirrel({
exe: 'austs-one-click-node.exe',
iconUrl:
'https://raw.githubusercontent.com/AustP/austs-one-click-node/main/assets/icons/win/icon.ico',
setupExe: 'austs-one-click-node-setup.exe',
setupIcon: path.join(ASSETS_DIR, 'icons', 'icon.ico'),
}),
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
html: './src/render/index.html',
js: './src/renderer.ts',
name: 'main_window',
preload: {
js: './src/preload.ts',
},
},
],
},
}),
],
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
draft: true,
repository: {
authToken: process.env.GITHUB_TOKEN,
name: 'austs-one-click-node',
owner: 'AustP',
},
},
},
],
};
export default config;