feat: Convert config.js to config.yaml (Issue #55)#56
Merged
EmersonFras merged 7 commits intomainfrom Mar 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the catalog’s configuration from a JavaScript global (public/config.js) to a YAML file (public/config.yaml) that’s fetched at runtime and parsed with js-yaml, aiming to keep configuration comment-friendly while avoiding executing arbitrary JS.
Changes:
- Add
public/config.yamland removepublic/config.jsas the configuration source. - Update
main.jsandindex.htmlto asynchronously fetch/parse config and apply branding/CSS/font/favicon at runtime. - Update
scripts/export-tags.jsto read YAML directly, and addjs-yamlas a dependency.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
public/config.yaml |
New YAML configuration file replacing JS config. |
public/config.js |
Removed previous JS-based CONFIG global. |
main.js |
Fetches/parses YAML config at runtime; applies UI settings after load with fallback behavior. |
index.html |
Removes config.js + inline config scripts; relies on main.js for config application. |
style.css |
Adds :root fallbacks for --color-accent-dark and --font-family during async config load. |
scripts/export-tags.js |
Loads config via js-yaml instead of regex + new Function(). |
package.json |
Adds js-yaml dependency. |
package-lock.json |
Lockfile updates reflecting js-yaml addition (and regenerated metadata). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…-tags Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…quoted custom property
Member
|
Looks good, though the README should also be updated to reflect the change. |
egrace479
reviewed
Mar 19, 2026
Co-authored-by: Elizabeth Campolongo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
public/config.jswithpublic/config.yamlas the sole configuration entry point for the catalog template. Configuration is fetched asynchronously at runtime viafetch('config.yaml')and parsed withjs-yaml.Changes Made
public/config.yaml- New YAML config file replacingconfig.js. Contains all the same settings (org name, branding, colors, API URL, additional repos, font) with inline comments.public/config.js- Deleted.main.js- Removed the synchronousCONFIGglobal check and top-levelconstdestructuring. Addedimport jsYaml from 'js-yaml'and a module-scopeconfigPromisethat starts fetchingconfig.yamlimmediately when the module loads (beforeDOMContentLoaded), so the network request is in-flight while the DOM parses. InsideDOMContentLoaded, config is awaited before anything else runs; CSS custom properties, document title, font link, and favicon are all applied from the resolved config. A visible error banner and safe defaults are used as fallback if the fetch fails.style.css- Added--color-accent-darkand--font-familyto the:rootblock alongside the existing color defaults. These two properties had no:rootfallback before, meaning they would render as unset during the async config fetch. The hardcoded values match the YAML defaults and are overridden by JS once config loads.index.html- Removed<script src="config.js">and three inline<script>blocks that synchronously applied config (CSS vars, font update, favicon). Kept the dark mode toggle script (it does not depend on CONFIG) and the static<link id="font-link">tag with the Inter default.scripts/export-tags.js- Replaced the regex +new Function()approach for extracting CONFIG fromconfig.jswith a directjsYaml.load(fs.readFileSync('public/config.yaml'))call.Closes #55