-
Notifications
You must be signed in to change notification settings - Fork 0
/
startDevServer.js
40 lines (38 loc) · 1016 Bytes
/
startDevServer.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
var fs = require("fs");
var glob = require("glob");
var exec = require("child_process").exec;
var path = require("path");
var devServerPath = path.join(
".",
"node_modules",
".bin",
"webpack-dev-server"
);
console.log(devServerPath);
var appDirectory = glob.sync("./framerPrototype/*.framer/app.js")[0];
fs.readFile(appDirectory, "utf8", function(err, data) {
if (err) {
throw err;
}
var line = data.match(/^.*Framer\.Importer\.load.*$/m)[0];
console.log(line);
var childProcess = exec(
"node " + devServerPath + " --open --mode=development --hot",
{
env: {
myLayersVar: line
}
}
).on("error", function(err) {
throw err;
});
childProcess.stdout.on("data", function(data) {
console.log("stdout", data.toString("utf8"));
});
childProcess.stderr.on("data", function(data) {
console.log("stderr", data.toString("utf8"));
});
childProcess.on("close", function(code) {
console.log("Process terminated with exit code ", code);
});
});