mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
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:
1 parent
142cf8a626
commit
6eda1f78d5
2 files changed
+15
-3
No files matched your search
@@ -72,6 +72,8 @@ The documentation uses the binaries provided by the packages, but for the develo
|
||||
npx clusteriohost -> node packages/host
|
||||
npx clusterioctl -> node packages/ctl
|
||||
|
||||
By default node does not enable source maps, to get stack traces pointing to the `.ts` files you will need to pass `--enable-source-maps` to `node` or set the environment variable `NODE_OPTIONS=--enable-source-maps`.
|
||||
|
||||
Note that to use `clusterioctl` you will have to create a control config first:
|
||||
|
||||
node packages/controller bootstrap create-ctl-config [admin-user]
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user