From 3d7c11a8b6274e0ad930da1a9778b849e6d033ba Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Jan 2024 21:48:58 +0100 Subject: [PATCH 1/4] Add missing enable source maps for host service --- CHANGELOG.md | 4 ++++ packages/create/create.js | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5013726a..c6ca039f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Added support for `color-settings` Mod settings (#568)[https://github.com/clusterio/clusterio/issues/568]. +### Changes + +- Fixed generated systemd file for clusteriohost not enabling source maps. + ## Version 2.0.0-alpha.14 diff --git a/packages/create/create.js b/packages/create/create.js index 7fcc62bc..fca70256 100755 --- a/packages/create/create.js +++ b/packages/create/create.js @@ -488,6 +488,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/clusteriohost run --log-level=warn --can-restart Restart=on-failure RestartPreventExitStatus=8 From 1d1e80fbf063dcfd5be7c34d467b4302feec1802 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Jan 2024 21:50:38 +0100 Subject: [PATCH 2/4] Export Control and related types from ctl --- CHANGELOG.md | 1 + packages/ctl/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ca039f..0df07f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changes - Fixed generated systemd file for clusteriohost not enabling source maps. +- Fixed ctl not exporting types used for adding commands to ctl plugins. ## Version 2.0.0-alpha.14 diff --git a/packages/ctl/index.ts b/packages/ctl/index.ts index 6a70dd21..54bd5f27 100644 --- a/packages/ctl/index.ts +++ b/packages/ctl/index.ts @@ -1,4 +1,5 @@ import { bootstrap } from "./ctl"; +export * from "./ctl"; export { default as BaseCtlPlugin } from "./src/BaseCtlPlugin"; if (module === require.main) { From 2872faab98de32f54a96b82a0ece70e42673bb05 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Jan 2024 22:47:56 +0100 Subject: [PATCH 3/4] Skip loading plugins without entrypoint on hosts If a plugin only has entrypoints at the controller level the config will skip adding a "load_plugin" config option for the given plugin to avoid making options that do nothing. If such a plugin is added to a host it will still reach loadPlugin which in turn tries to check the load_plugin config and throw an error on startup due the field being missing. Skip trying to load plugins without an entrypoint at the instance or host level in hosts before checking the load_plugin config field. --- CHANGELOG.md | 1 + packages/host/src/Host.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0df07f19..9b4c4bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fixed generated systemd file for clusteriohost not enabling source maps. - Fixed ctl not exporting types used for adding commands to ctl plugins. +- Fixed controller only plugins throwing an error about missing a config field on startup out when added to hosts. ## Version 2.0.0-alpha.14 diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index 5ecfb5bd..7381ad36 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -377,7 +377,10 @@ export default class Host extends lib.Link { async loadPlugins() { for (let pluginInfo of this.pluginInfos) { - if (!this.config.get(`${pluginInfo.name}.load_plugin` as keyof lib.HostConfigFields)) { + if ( + !pluginInfo.hostEntrypoint && !pluginInfo.instanceEntrypoint + || !this.config.get(`${pluginInfo.name}.load_plugin` as keyof lib.HostConfigFields) + ) { continue; } From e0161114e736b878a253caa38b4b19980ed145e9 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Jan 2024 23:11:58 +0100 Subject: [PATCH 4/4] Fix --no-download-headless conflict in installer Fix installer incorrectly exiting with a conflicting options errors when the --no-download-headless option was used in conjunction with the --factorio-dir option. --- CHANGELOG.md | 1 + packages/create/create.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b4c4bf3..ca5d4e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Fixed generated systemd file for clusteriohost not enabling source maps. - Fixed ctl not exporting types used for adding commands to ctl plugins. - Fixed controller only plugins throwing an error about missing a config field on startup out when added to hosts. +- Fixed installer incorrectly claiming the options --factorio-dir and --no-download-headless conflicts with each other. ## Version 2.0.0-alpha.14 diff --git a/packages/create/create.js b/packages/create/create.js index fca70256..c222ab04 100755 --- a/packages/create/create.js +++ b/packages/create/create.js @@ -612,7 +612,7 @@ async function inquirerMissingArgs(args) { }, ], answers); - if (answers.downloadHeadless) { + if (!answers.factorioDir && answers.downloadHeadless) { answers.factorioDir = "factorio"; } } @@ -760,7 +760,7 @@ async function main() { "Can be set to false using --no-download-headless.", type: "boolean", }) - .conflicts("factorio-dir", "download-headless"); + ; } args = args.argv; @@ -780,6 +780,9 @@ async function main() { let answers = await inquirerMissingArgs(args); if (answers.downloadHeadless) { + if (answers.factorioDir !== "factorio") { + throw new InstallError("--download-headless option requires --factorio-dir to be set to factorio"); + } await downloadLinuxServer(); }