-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathforge.config.js
90 lines (82 loc) · 2.63 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
const fs = require('fs-extra');
const path = require('path');
const sass = require('sass');
const assetBuildDir = path.resolve(__dirname, './build');
// const includePaths = [
// 'src',
// 'build',
// 'LICENSE',
// 'package.json',
// 'node_modules',
// ];
// TODO: resolve issues with packaging when ignoring paths
// const ignoredPaths = fs.readdirSync(__dirname).filter((pathname) => (
// !includePaths.includes(pathname)
// ));
// if (process.platform === 'win32') process.env.GYP_MSVS_VERSION = '2019';
module.exports = {
packagerConfig: {
icon: './src/assets/enhancr-icon',
asar: {
unpack: "**/node_modules/{@mafiosnik,@ffprobe-installer,@ffmpeg-installer,axios}/**/*"
},
ignore: [
'src/scss',
'src/external',
'src/inference',
'src/utils',
/\.map$/i,
// ...ignoredPaths,
],
},
hooks: {
generateAssets: async () => {
const compiledScss = sass.compile('./src/scss/app.scss', {
style: 'compressed',
sourceMap: true,
});
compiledScss.css += '\n/*# sourceMappingURL=app.min.css.map */';
await fs.ensureDir(assetBuildDir);
await fs.emptyDir(assetBuildDir);
await fs.writeFile(
path.resolve(assetBuildDir, 'app.min.css'),
compiledScss.css,
);
await fs.writeFile(
path.resolve(assetBuildDir, 'app.min.css.map'),
JSON.stringify(compiledScss.sourceMap),
);
},
postMake: () => {
const pythonDir = './src/external/'
const inferenceDir = './src/inference/'
const utilsDir = './src/utils/'
const targetDirPython = './out/enhancr-win32-x64/resources/external'
const targetDirInference = './out/enhancr-win32-x64/resources/inference'
const targetDirUtils = './out/enhancr-win32-x64/resources/utils'
fs.copySync(pythonDir, targetDirPython);
fs.copySync(inferenceDir, targetDirInference);
fs.copySync(utilsDir, targetDirUtils);
}
},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
name: 'enhancr',
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
};