-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.js
46 lines (35 loc) · 1.15 KB
/
package.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
const fs = require('fs');
const path = require('path');
const packager = require('@electron/packager');
const glob = require('glob');
const packagerOptions = {
dir: '.',
out: 'dist',
platform: 'win32',
overwrite: true,
asar: false,
afterCopy: [
cleanSources
],
icon: 'icon.ico'
};
packager(packagerOptions).then(outPath => {
console.log(`build path: ${outPath}`);
});
// remove folders & files not to be included in the app
function cleanSources(buildPath, electronVersion, platform, arch, callback) {
// New resources path
const resourcesPath = path.join("");
// Find all .obj files
const objFiles = glob.sync('**/*.{obj,fbx,png,jpeg, jpg, js, txt, wav, mp3, mp4}', { cwd: '.' });
objFiles.forEach((objFile) => {
const destFile = path.join(buildPath, objFile);
const sourceFile = path.join(resourcesPath, objFile);
const destDir = path.dirname(destFile);
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
fs.copyFileSync(sourceFile, destFile);
});
callback();
}