This repository has been archived by the owner on Jun 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathrelease.js
74 lines (65 loc) · 1.98 KB
/
release.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
var minimist = require('minimist');
var packager = require('electron-packager');
var execSync = require('child_process').execSync;
var path = require('path');
function build() {
console.log('Packaging with webpack, using the production config');
var child = execSync('npm run-script build', function(err, stdout, stderr) {
console.log('stderr: ', stderr);
if (err !== null) {
console.log('error: ', err);
}
});
}
function pack(platform, arch, noprune) {
var opts = {}; //packaging options
if (!platform || !arch) {
console.log('Packaging for all platforms');
opts.all = true; // build for all platforms and arch
} else {
console.log('Packaging for: ', platform, arch);
opts.platform = platform;
opts.arch = arch;
}
opts.dir = __dirname; // source dir
opts.name = 'dawn';
opts.prune = !noprune; //remove dev dependencies unless noprune is set
opts.icon = './icons/pieicon';
opts.asar = true;
opts.version = '0.36.2';
opts.out = path.resolve('..'); // build in the parent dir
packager(opts, function(err, appPath) {
if (err) {
console.log('Packaging error: ', err);
} else {
if (typeof appPath === 'string') {
console.log('Zipping: ', appPath);
execSync(`7z a -tzip ${appPath}.zip ${appPath}`, function(err, stdout, stderr) {
if (err !== null) {
console.log('error: ', err);
}
});
} else {
appPath.forEach(function(folderPath) {
console.log('Zipping: ', folderPath);
execSync(`7z a -tzip ${folderPath}.zip ${folderPath}`, function(err, stdout, stderr) {
if (err !== null) {
console.log('error: ', err);
}
});
});
}
}
});
}
// General release command: 'node release.js --prod'.
// If you already ran build: 'node release.js --prod --prebuilt'
// For a specific target: 'node release.js --platform=... --arch=...'
function main() {
var argv = minimist(process.argv.slice(2));
if (!argv.prebuilt) {
build();
}
pack(argv.platform, argv.arch, argv.noprune);
}
main();