Skip to content

fix(cli): forward plugins and appPaths from config to createServer (#592)#593

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
fix/592-cli-forward-plugins-apppaths
Jul 11, 2026
Merged

fix(cli): forward plugins and appPaths from config to createServer (#592)#593
melvincarvalho merged 1 commit into
gh-pagesfrom
fix/592-cli-forward-plugins-apppaths

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Fixes #592.

Problem

loadConfig merges plugins (#589) and appPaths (#582) from config.json, but the explicit allowlist bin/jss.js passes to createServer(...) omitted both — so the documented config-file route ("declare the apps in config and the server imports, mounts, and tears them down itself") silently booted a server with no plugins and no error. That's exactly the silent-missing-app failure mode src/plugins.js was designed to refuse, and it left the #206 loader programmatic-only: nothing driving JSS through the CLI (including servejss) could mount plugins.

Fix

Forward both keys in the createServer call. createServer already defaults each when undefined (Array.isArray guards), so configs that don't set them are unaffected.

Verified (A/B)

Config with {"plugins": [{"module": "…/hello-plugin.mjs", "prefix": "/hello-app", "config": {"greeting": "hi"}}]}:

  • with fix: jss start -c config.json mounts the app; GET /hello-app/hello{"from":"plugin","config":{"greeting":"hi"}}
  • without fix (current main): same config boots cleanly, route → 404

Also confirmed a bad module path now fails the boot loudly through the CLI, as the loader intends.

Follow-ups from #592 (repeatable --plugin CLI flag; pluginDataDir override so servejss-served trees don't collect .plugins/) left for separate PRs.

)

loadConfig merges both keys from config.json, but the explicit
createServer allowlist in bin/jss.js omitted them — so the documented
'declare the apps in config' route (#206/#589, docs/configuration.md)
silently booted a server with no plugins, exactly the missing-app
failure mode the loader was designed to refuse. Same for appPaths
(#582).

Verified: jss start -c config.json with a plugins entry now mounts the
app (route responds, config delivered to activate); before the fix the
same config booted with a 404 on the plugin route.
@melvincarvalho
melvincarvalho requested a review from Copilot July 11, 2026 06:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@melvincarvalho
melvincarvalho merged commit 328833d into gh-pages Jul 11, 2026
1 check passed
@melvincarvalho
melvincarvalho deleted the fix/592-cli-forward-plugins-apppaths branch July 11, 2026 06:50
melvincarvalho added a commit that referenced this pull request Jul 11, 2026
The CLI config-file plugins block, first item remaining from #206
(#592, #593): bin/jss.js now forwards plugins and appPaths from the
loaded config to createServer, so jss start -c config.json mounts the
declared apps instead of silently booting without them. The documented
'declare the apps in config' route works from the CLI, and CLI drivers
like servejss can now reach the plugin loader through a config file.
No config auto-loading: plugins execute only from a file explicitly
passed with -c. Remaining from #206: a repeatable --plugin CLI flag
and a pluginDataDir override so served trees don't collect .plugins/
(both scoped in #592), #583 raw-body mode, #564 feature migration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI silently drops plugins and appPaths from config — #206 loader unreachable from jss start

2 participants