This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
67 lines (60 loc) · 1.57 KB
/
build.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
const packager = require('electron-packager')
const exec = require('child_process').exec
if(process.argv.length < 2) {
console.error('Usage: node compile.js (win32 | macintel | macarm | linux)')
process.exit(1)
}
let type = process.argv[2]
let PLATFORM, ARCH
function execute(command, callback) {
exec(command, (error, stdout, stderr) => {
callback(stdout);
});
};
async function bundleElectronApp(options) {
const appPaths = await packager(options)
console.log(`Electron app bundles created:\n${appPaths.join("\n")}`)
}
switch (type) {
case "win32":
PLATFORM = "win32"
ARCH = "x64"
break;
case "macintel":
PLATFORM = "darwin"
ARCH = "x64"
break;
case "macarm":
PLATFORM = "darwin"
ARCH = "arm64"
break;
case "linux":
PLATFORM = "linux"
ARCH = "x64"
break;
default:
console.error("Not supported or nonsense OS/Arch. Try again maybe?")
break;
}
// build electron app (read parameter os and arch), ignore .gitignore, src/source, src/ignore
bundleElectronApp({
dir: '.',
name: 'BMS Radio Station',
appBundleId: 'com.sorae42.bmsradio',
arch: ARCH,
platform: PLATFORM,
ignore: [
'.gitignore',
'build.js',
'builds'
],
out: 'builds',
overwrite: true,
asar: true,
prune: true,
icon: 'iconset/logo',
appVersion: require('./package.json').version,
buildVersion: execute('git rev-parse --short HEAD', (output) => {
return output.slice(0, 6)
})
})