-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
39 lines (32 loc) · 1022 Bytes
/
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
const fs = require('fs');
const shell = require('shelljs');
const archiver = require('archiver');
const version = require('./package.json').version;
shell.cd('dist/');
const systems = [];
shell.ls().forEach(folder => {
if (folder.startsWith('relief-valve')) {
const [, , platform, arch] = folder.split('-');
const id = `${platform}-${arch}`;
systems.push(id);
shell.mkdir(id);
shell.mv(folder, `${id}/Relief Valve v${version}`);
}
});
shell.cd('..');
shell.mkdir('build');
systems.forEach(id => {
if (id === 'darwin-x64') {
shell.pushd('dist/darwin-x64');
shell.exec(`tar czf ../../build/Relief-Valve-v${version}-${id}.tar.gz *`);
console.log(`Built for ${id}`);
shell.popd();
} else {
const archive = archiver.create('zip');
const out = fs.createWriteStream(`build/Relief-Valve-v${version}-${id}.zip`);
archive.on('end', () => console.log(`Built for ${id}`));
archive.directory(`dist/${id}/`, '/');
archive.finalize();
archive.pipe(out);
}
});