Skip to content

Struct/platform keys - #126

Open
egrace479 wants to merge 6 commits into
devfrom
struct/platform-keys
Open

Struct/platform keys#126
egrace479 wants to merge 6 commits into
devfrom
struct/platform-keys

Conversation

@egrace479

Copy link
Copy Markdown
Member

Closes #123.

Platform-specific, non-UI value fetching functions are now consolidated in src/utils/definePlatformVals.js. I left src/utils/defineRibbonVals.js because the SVG import is incompatible with the release fetch. This PR preps for GitLab support with all needed keys added into the getPlatformVals function (extracted from fetchCodeRepos), though the GitLab option is commented out.

This update should make it so that someone looking to run their own catalog on another code platform will only need to update the token handling in the scripts (and set the platform in the config).

I used Gemini for help updating the testing setup.

Reduces platform-specific edits required to token-handling in scripts
fallback defined at UI render
@egrace479
egrace479 requested a review from Copilot July 30, 2026 00:14
@egrace479 egrace479 added structure Refactoring or architecture, general code organization javascript Pull requests that update javascript code labels Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates code-platform-specific keys and API URL construction into a single utility (src/utils/definePlatformVals.js) to reduce duplication and prepare the codebase for future GitLab support, while updating the runtime app, scripts, and tests to use the new centralized definitions.

Changes:

  • Added getPlatformVals and expanded getPlatformApiUrls (now includes releaseSuffix) and updated call sites across main.js, scripts, and API modules.
  • Refactored fetchCodeRepos to use platform-specific data keys (full name, fork, URL, stars) via getPlatformVals.
  • Updated release-fetching logic to use the platform-specific release path suffix and adjusted tests accordingly.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/api/fetchCodeRepos.test.js Updates tests to use centralized platform key/url utilities and validate updated fetchCodeRepos behavior.
src/utils/definePlatformVals.js New consolidated utility for platform-specific repo keys and API URL definitions (plus release suffix).
src/utils/defineApiUrls.js Removed in favor of definePlatformVals.js.
src/api/fetchStats.js Adds releaseSuffix parameter to support platform-specific latest-release endpoints.
src/api/fetchCodeRepos.js Uses getPlatformVals for platform-specific repo fields (stars, full name, fork, URL, profile repo).
scripts/fetch-releases.js Uses centralized platform URL/key definitions and releaseSuffix when fetching latest releases.
scripts/export-tags.js Uses centralized platform URL/key definitions for tag collection.
main.js Switches to definePlatformVals URLs and threads releaseSuffix into fetchCatalogStats.
Comments suppressed due to low confidence (1)

tests/api/fetchCodeRepos.test.js:110

  • The expected html_url in this test is currently built from repoApiUrl (API base). Update the expectation to match the mocked browser URL value so the test reflects real platform responses.
        expect(items[0].html_url).toBe(`${platformConfig.repoApiUrl}test-org/code-repo`);

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

Comment thread src/api/fetchCodeRepos.js
Comment thread tests/api/fetchCodeRepos.test.js Outdated
Comment thread src/api/fetchStats.js Outdated

This comment was marked as outdated.

This comment was marked as outdated.

@egrace479
egrace479 requested review from beanbean9339 and hlapp July 30, 2026 16:07
@egrace479 egrace479 linked an issue Jul 31, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code structure Refactoring or architecture, general code organization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate platform specific keys

2 participants