-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: update runtime config support #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BREAKING CHANGE: rename `mfeConfigApiUrl` to `runtimeConfigJsonUrl` BREAKING CHANGE: remove `siteId` from config URL building add cache buster for development environments
- Remove siteId from test config (no longer used) - Simplify configureCache mock (no URL param parsing needed) - Rename test to clarify it tests merge behavior - Test proper merge: runtime overrides build-time, build-time values preserved, runtime values added Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Test that app-level config in runtime properly merges with build-time app config - Simulates full flow by calling addAppConfigs() after initialize - Verifies runtime overrides build-time, build-time preserved, and runtime additions work at the app config level Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace supportEmail with theme config (realistic optional config) - Use fake.url pattern for test URLs: - fake.config.url for runtime config endpoint - fake.cdn.url for CDN resources (theme, logos) - fake.lms.url for LMS base URL Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Used Claude to update tests, found a few other things in the process. The Claude changes were PR'd on my fork. I left a comment on that PR with the log. brian-smith-tcril#1 |
- Add appConfigOnly option to mergeSiteConfig for runtime config - Runtime config: only merge config for existing apps, ignore new apps - Build-time config: full app merge by appId, allow adding new apps - Add lodash.keyby dependency for cleaner implementation Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add comprehensive unit tests covering all code paths in mergeSiteConfig: - Top-level config merging (new values, overrides, preservation) - App merging with full merge (default behavior) - App merging with appConfigOnly option - Edge cases (empty arrays, undefined apps, missing config) Uses jest.spyOn pattern for verifying publish(CONFIG_CHANGED) calls. Co-Authored-By: Claude Opus 4.5 <[email protected]>
20ce407 to
d05935e
Compare
runtime/config/index.ts
Outdated
| * Apps are merged by appId rather than array index. By default, new apps can be added. | ||
| * When `appConfigOnly` is true, only the `config` property of existing apps is merged, | ||
| * and new apps are ignored. | ||
| * | ||
| * @param {Object} newSiteConfig | ||
| * @param {Object} options | ||
| * @param {boolean} options.appConfigOnly - Only merge app config for existing apps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better explain what appConfigOnly implies:
- still merge all non-app parts of the config
- only merge the "config" parts of each app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in b2729a9
fyi @arbrandes
Clearer name that doesn't imply "only do app stuff" - it still merges all non-app config normally. Also improved JSDoc to clarify behavior. Co-Authored-By: Claude Opus 4.5 <[email protected]>
arbrandes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you!
| const params = new URLSearchParams(); | ||
| params.append('mfe', siteId); | ||
| const url = `${mfeConfigApiUrl}?${params.toString()}`; | ||
| const runtimeConfigUrl = new URL(runtimeConfigJsonUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but the URL constructor will fail if the URL is relative - something Tutor might actually do by default once the translation layer is in place.
No worries, though: we can discuss this once the translation layer is in place.
BREAKING CHANGE: rename
mfeConfigApiUrltoruntimeConfigJsonUrlBREAKING CHANGE: remove
siteIdfrom config URL buildingadd cache buster for development environments