-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathforge.config.js
60 lines (57 loc) · 1.66 KB
/
forge.config.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
const path = require("path");
const fs = require('fs');
const { execSync } = require('child_process');
const os = require("os");
module.exports = {
packagerConfig: {
packageManager: "npm",
icon: "src/icons/icon",
asar: true,
overwrite: true,
ignore: [
"source",
"compile.sh",
"framework",
"README*",
"LICENSE",
"doc",
"dict.dic",
".gitignore",
".gitsubmodules",
".github",
".idea",
".vscode"
],
extraResource: [
"framework",
"dict.dic"
]
},
makers: [
{
name: "@electron-forge/maker-zip",
platforms: [
"darwin",
"linux",
"win32"
]
}
],
hooks: {
"generateAssets": async () => {
const hash = execSync('git rev-parse --short HEAD').toString().trim();
const version = require('./package.json').version;
const data = {
version: `v${version}-${hash}`,
builder: process.env["NFCTOOLSGUI_COMPILER"] ? process.env["NFCTOOLSGUI_COMPILER"] : os.userInfo().username
}
fs.writeFileSync('./src/buildInfo.json', JSON.stringify(data, null, 2), 'utf-8');
},
"packageAfterPrune": async (forgeConfig, buildPath) => {
const url = path.join(buildPath, 'node_modules/@serialport/bindings-cpp/build/node_gyp_bins')
fs.unlink(path.join(url, "python3"), () => {
fs.rmdir(url, () => {})
});
}
}
}