-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_file.js
38 lines (31 loc) · 948 Bytes
/
build_file.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
const fs = require('fs');
const path = require('path');
const child_process = require('child_process');
function build_vue () {
return new Promise((resolve) => {
const file_name = "slide.vue";
const source_path = path.join(__dirname, '/lib/vue/', file_name);
const copy_path = path.join(__dirname, '/build/vue', file_name);
const read_stream = fs.createReadStream(source_path);
const write_stream = fs.createWriteStream(copy_path);
read_stream.pipe(write_stream);
read_stream.on('end', (err) => {
if (err) {
console.log(err + '\n');
return;
}
resolve();
})
})
}
function compress_tgz () {
child_process.spawn('tar', ['-zcvf', './binaries/Source code.tar.gz', './build'])
}
function compress_zip () {
child_process.spawn('zip', ['-q', '-r', './binaries/Source code.zip', './build']);
}
build_vue().then(() => {
// linux or mac
compress_zip();
compress_tgz();
})