-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.js
64 lines (59 loc) · 1.7 KB
/
main.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const { COORDINATOR_MODULE_PATH } = require("./src/CONSTANTS");
const ConfigUtil = require("./src/ConfigUtil");
const StreamMultiplexer = require("./src/StreamMultiplexer");
const fs = require("fs");
async function get_webpack_started(cfg) {
fs.rmSync("./TYPECODE.out", { recursive: true });
if (cfg.enable_TYPECODE) {
//TODO make this configurable
const webpack_log_output = [
[
"node",
"./node_modules/logrotate-stream/bin/logrotate-stream",
"./logs/webpack.log",
"--keep",
"3",
"--size",
"1500000",
],
null,
];
//Run webpack once so we are guaranteed to have the compiled files
let wp_seed;
console.log("Starting Initial WebPack");
//initially we do not use log_pipes because when the process terminates it will close our stdin/out
wp_seed = StreamMultiplexer.spawn_sink(
"node",
"./node_modules/webpack/bin/webpack",
"--no-color",
);
await new Promise((resolve) => {
wp_seed.on("close", resolve);
});
console.log("Initial WebPack is done");
wp_seed = StreamMultiplexer.setup_log_pipes(
webpack_log_output,
"./node_modules/webpack/bin/webpack",
"--no-color",
"--watch",
);
}
}
(async () => {
await ConfigUtil.interactive();
const cfg = require("./config");
await get_webpack_started(cfg);
const log_sinks = cfg.log_sinks || [
[
"node",
"./node_modules/logrotate-stream/bin/logrotate-stream",
"./logs/caracAL.log.jsonl",
"--keep",
"3",
"--size",
"4500000",
],
["node", "./standalones/LogPrinter.js"],
];
StreamMultiplexer.setup_log_pipes(log_sinks, COORDINATOR_MODULE_PATH);
})();