-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.js
30 lines (24 loc) · 968 Bytes
/
setup.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
"use strict"
const fs = require("fs");
const exec = require("child_process").exec;
const spawn = require("child_process").spawn;
const npm = process.platform === "win32" ? "npm.cmd":"npm";
const mode = "inherit";
function spawner(cmd, args, dirname) {
return new Promise((resolve, reject) => {
var childSpawn = spawn(cmd, args, {stdio: mode, cwd: dirname});
childSpawn.on("exit", function (code) {
if (code != 0) {
console.log("Failed: " + code);
reject();
} else {
resolve()
}
});
});
}
this.mainPath = `${__dirname}${process.platform === "win32" ? "\\":"//"}`
this.samplePath = `${__dirname}${process.platform === "win32" ? "\\sample":"//sample"}`
let NpmInstallRoot = spawner(npm, ["install"], this.mainPath).then(()=>{
let NpmInstallSample = spawner(npm, ["install"], this.samplePath);
});