This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forge.config.js
102 lines (91 loc) · 2.42 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
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
const path = require('path')
const minimatch = require('minimatch')
const fs = require('fs')
const { author, version, description, homepage, productName } = require('./package.json')
const PATHS_TO_INCLUDE = [
'/build',
'/build/**',
'/electron',
'/electron/**',
'/common',
'/common/**',
'/node_modules',
'/node_modules/**',
'/package.json',
'/LICENSE.md',
]
const EXTS_TO_IGNORE = ['map', 'o', 'obj']
const shouldInclude = filePath => PATHS_TO_INCLUDE.reduce((soFar, p) => {
return soFar || minimatch(filePath, p)
}, false)
const linuxPkgConfig = {
compressionLevel: 9,
maintainer: author,
description,
productDescription: description,
productName,
name: productName,
version,
homepage,
icon: path.join(__dirname, 'electron', 'images', 'logo.png'),
license: "AGPLv3",
}
module.exports = {
makers: [
{
"name": "@electron-forge/maker-deb",
"config": {
...linuxPkgConfig,
},
platforms: ['linux']
},
{
name: '@electron-forge/maker-zip',
platforms: ['linux', 'win32', 'darwin']
},
{
name: '@electron-forge/maker-dmg',
platforms: ['darwin'],
config: {
overwrite: true,
icon: path.join(__dirname, 'electron', 'images', 'logo.png'),
background: path.join(__dirname, 'build-tools', 'packaging', 'dmg', 'background.png'),
}
},
// {
// name: '@electron-forge/maker-squirrel',
// platforms: ['win32'],
// config: {
// name: productName,
// setupExe: `${productName} Setup`,
// setupMsi: `${productName} Installer`,
// setupIcon: path.join(__dirname, 'electron', 'images', 'logo.ico'),
// }
// }
],
packagerConfig: {
appCopyright: 'Copyright (c) erdDEV team',
appCategoryType: 'public.app-category.finance',
prune: true,
icon: path.join(__dirname, 'electron', 'images', 'logo'),
ignore: filePath => {
let ret
if ('' === filePath) {
ret = false
} else if (EXTS_TO_IGNORE.includes(path.extname(filePath).substr(1))) {
ret = true
} else {
ret = !shouldInclude(filePath)
}
return ret
}
},
hooks: {
packageAfterCopy: async (cfg, appDir/*, electronVersion, platform, arch */) => {
console.log(`Writing buildConfig.json for prod...`)
fs.writeFileSync(path.join(appDir, 'buildConfig.json'), JSON.stringify({
mode: 'prod'
}), 'utf8')
}
}
}