-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.js
More file actions
25 lines (20 loc) · 748 Bytes
/
start.js
File metadata and controls
25 lines (20 loc) · 748 Bytes
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
const { spawn } = require("child_process");
const { writeFileSync } = require("fs");
const path = require("path");
const binGameJs = "bin/game.js";
const binGameWasm = "bin/game.wasm";
const sceneJsonPath = path.resolve("./scene.json");
let sceneJson = require(sceneJsonPath);
sceneJson.main = binGameJs;
writeFileSync(sceneJsonPath, JSON.stringify(sceneJson, null, 2));
const childProcess = spawn("dcl", ["start"], {
stdio: [process.stdin, process.stdout, process.stderr],
});
childProcess.on("exit", () => {
process.exit();
});
setTimeout(() => {
sceneJson.main = binGameWasm;
writeFileSync(sceneJsonPath, JSON.stringify(sceneJson, null, 2));
console.log("\n\n## Now you can enter to preview and load WASM module. ##");
}, 10000);