-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.js
46 lines (40 loc) · 1.21 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
#!/usr/bin/env node
// This is a wrapper script around electron-packager and other tasks for output.
var exec = require('child_process').execSync,
rimraf = require('rimraf'),
args = require('yargs').argv,
out = args.out || './builds',
arch = args.arch || process.arch,
platform = args.platform || process.platform,
productName = args.name || require('./package.json').productName,
nodeVersion = parseFloat(process.version.substr(1, 5)),
adjustedOut = out + '/' + platform + '/' + arch,
asar = !!args.asar;
if (nodeVersion < 0.12) {
process.stderr.write('This project requires node >= 0.12');
process.exit(1);
} else {
process.stdout.write('Preparing app for platform ' + platform + ' ' + arch + '\n');
}
var electronPackager = [
'node',
'./node_modules/electron-packager/cli.js',
'.',
productName,
'--prune',
'--arch=' + arch,
'--version=0.27.3',
'--out=' + adjustedOut,
'--platform=' + platform,
'--ignore=./builds/',
'--ignore=./gulpfile.js'
];
if (asar) {
electronPackager.push('--asar');
}
process.stdout.write('Removing ' + adjustedOut + '\n');
rimraf.sync(adjustedOut);
process.stdout.write('Executing ' + electronPackager.join(' ') + '\n');
exec(electronPackager.join(' '), {
cwd: __dirname
});