forked from morethanwords/tweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
39 lines (32 loc) · 1017 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
// @ts-check
const { spawn } = require('child_process');
const version = process.argv[2] || 'same';
const changelog = process.argv[3] || '';
const child = spawn(`npm`, ['run', 'change-version', version, changelog].filter(Boolean));
child.stdout.on('data', (chunk) => {
console.log(chunk.toString());
});
child.on('close', (code) => {
if(code != 0) {
console.log(`child process exited with code ${code}`);
}
const child = spawn(`npm`, ['run', 'build']);
child.stdout.on('data', (chunk) => {
console.log(chunk.toString());
});
child.on('close', (code) => {
if(code != 0) {
console.error(`child process exited with code ${code}`);
} else {
console.log('Compiled successfully.');
}
});
});
/* exec(`npm run change-version ${version}${changelog ? ' ' + changelog : ''}; npm run build`, (err, stdout, stderr) => {
if(err) {
return;
}
// the *entire* stdout and stderr (buffered)
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
}); */