-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.js
35 lines (31 loc) · 970 Bytes
/
install.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
const common = require('./common.js');
const fs = require('fs');
const path = require('path');
const axios = require('axios').default;
const env = require('dotenv').config();
const { spawn } = require('child_process');
// NPM Install
function installApp() {
spawnProcess('npm', ['install'], function() {
spawnProcess('npm', ['run', 'build']);
});
}
function spawnProcess(cmd, args, callback = function() {
console.log("End of processes");
}) {
const process = spawn(cmd, args, {stdio: ['inherit']});
process.stdout.on('data', function(data) {
console.log(data.toString());
});
process.stderr.on('data', function(data) {
console.log('stderr: ' + data.toString());
});
process.on('exit', function(code) {
console.log('child process exited with code ' + code.toString());
});
process.on('close', function() {
console.log('Calling callback');
callback();
});
}
installApp();