Turn on --enable-source-maps

Turn on source map deduction in stack traces from thrown errors. This
feature is off by default due to potential performance degration in
certain corner cases.  For the dev environment add instructions for
passing the option to node.
This commit is contained in:
Hornwitser committed 2023-11-24 20:53:16 +01:00
1 parent 142cf8a626
commit 6eda1f78d5
2 files changed
+15 -3

No files matched your search

+13 -3
View File
@@ -375,17 +375,26 @@ async function writeScripts(mode) {
if (process.platform === "win32") {
await safeOutputFile(
"run-controller.cmd",
"@echo off\n.\\node_modules\\.bin\\clusteriocontroller.cmd run\n"
`\
@echo off.
set "NODE_OPTIONS=--enable-source-maps %NODE_OPTIONS%"
\\node_modules\\.bin\\clusteriocontroller.cmd run
`
);
} else {
await safeOutputFile(
"run-controller.sh",
"#!/bin/sh\nexec ./node_modules/.bin/clusteriocontroller run\n",
`\
#!/bin/sh
export "NODE_OPTIONS=--enable-source-maps $NODE_OPTIONS"
exec ./node_modules/.bin/clusteriocontroller run
`,
{ mode: 0o755 },
);
await safeOutputFile(
"systemd/clusteriocontroller.service",
`[Unit]
`\
[Unit]
Description=Clusterio Controller
[Service]
@@ -394,6 +403,7 @@ Group=${await groupIdToName(os.userInfo().gid)}
WorkingDirectory=${process.cwd()}
KillMode=mixed
KillSignal=SIGINT
Environment=NODE_OPTIONS=--enable-source-maps
ExecStart=${process.cwd()}/node_modules/.bin/clusteriocontroller run --log-level=warn
[Install]