This repository was archived by the owner on Sep 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.js
More file actions
57 lines (48 loc) · 1.52 KB
/
release.js
File metadata and controls
57 lines (48 loc) · 1.52 KB
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
const { spawn } = require('child_process');
const os = require('os');
const packageInfo = require('./package.json');
const npm = (os.platform() === 'win32' ? 'npm.cmd' : 'npm');
const node = (os.platform() === 'win32' ? 'node.exe' : 'node');
var exec = (file, args, wd) => {
return new Promise((resolve, reject) => {
console.log(file, args, wd);
const ex = spawn(file, args, { stdio: 'inherit', env: process.env, cwd: wd });
ex.on('close', code => {
if (code === 0) {
resolve();
} else {
reject("Exit " + code);
}
});
});
}
var buildCertgen = () => {
if (os.platform() === 'win32') {
return exec('build.cmd', [], 'certgen');
}
return exec('/bin/bash', ['build.sh'], 'certgen');
}
var package = () => {
switch (os.platform()) {
case 'win32':
return exec(node, ['build.windows.js'], __dirname);
case 'darwin':
return exec(node, ['build.darwin.js'], __dirname);
case 'linux':
return exec(node, ['build.linux.js'], __dirname);
}
return Promise.reject('unknown platform');
}
var docker = () => {
if (os.platform() !== 'linux') {
return Promise.resolve();
}
return exec('/bin/bash', ['build.sh', packageInfo.version], 'docker');
}
(async () => {
await buildCertgen();
await exec(npm, ['i'], __dirname);
await exec(node, ['start_webpack.js', '--mode', 'production'], __dirname);
await package();
await docker();
})();