-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.js
executable file
·42 lines (34 loc) · 1.14 KB
/
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
36
37
38
39
40
41
42
#!/usr/bin/env node
var exec = require("child_process").exec;
console.log("Starting setup.")
function handleError(errMessage) {
console.error(errMessage);
console.error("This is bad. Recheck the dependencies and try again.");
process.exit(1);
}
function buildFrontend(callback) {
console.log("Starting to compile the frontend.");
exec("npm run build-production", function(err, stdout, stderr) {
if(err) {
handleError("Could not compile the frontend: " + stderr);
}
console.log("Finished compiling the frontend");
if(callback) callback();
})
}
function installFrontend(callback) {
console.log("Starting to install frontend dependencies.");
exec("npm install", function(err, stdout, stderr) {
if(err) {
handleError("The frontend dependencies could not be installed: " + stderr);
}
console.log("Installed frontend dependencies.");
buildFrontend(callback);
})
}
var lastPath = process.cwd();
process.chdir(__dirname + "/files/frontend");
installFrontend(function() {
process.chdir(lastPath);
console.log("Everything done.");
});