Skip to content
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

Refactor - use renderVersionBadge - part 4 [githubrelease githubtag] #10656

Merged

Conversation

jNullj
Copy link
Contributor

@jNullj jNullj commented Nov 4, 2024

This pull request refactors the codebase to use the renderVersionBadge function for rendering version badges.
Refactored github releases and github tags.
The pull request also modifies tests where needed.

I added forcePrerelease option to renderVersionBadge for github, might be usefull for any api that indicates prerelease explicitly.

while for github release we don't effect colors, for github tags this pr changes the logic a bit, and improves horizontal consistency.
we used to mark all tags blue if user picked latest over semver sort. this is odd as with releases we do mark prerelease in orange.
I guess the diffrence is due to api indicating prereleases, but we already try to guess prereleases in renderVersionBadge so i figured we might just as well try and use it while increasing consistency.

This PR should be the last in this refactor, we do have a few outliers services like `

visual-studio-app-center-releases-osversionorclojars` but i couldn't find anything else to refactor, let me know if you find anything.
Until you do, closes #2026

Sometimes API would indicate if a version is pre-release while the version number does not have to be semantically a prerelease like in github-release service.
We don't use a isPrerelease that can also force a non-preleases as we trust here developer semantic over API tagging.
@jNullj jNullj added developer-experience Dev tooling, test framework, and CI core Server, BaseService, GitHub auth, Shared helpers javascript [dependabot only] Pull requests that update Javascript packages labels Nov 4, 2024
Copy link
Contributor

github-actions bot commented Nov 4, 2024

Warnings
⚠️ This PR modified service code for github but not its test code.
That's okay so long as it's refactoring existing code.
Messages
📖 ✨ Thanks for your contribution to Shields, @jNullj!

Generated by 🚫 dangerJS against dfc6d83

@jNullj jNullj changed the title Refactor - use renderVersionBadge - part 4 [github] Refactor - use renderVersionBadge - part 4 [githubrelease githubtag] Nov 7, 2024
@@ -237,6 +237,7 @@ function rangeStart(v) {
* @param {string} [options.prefix] - The prefix to display on the message, such as ">=", "v", overrides the default behavior of using addv
* @param {string} [options.postfix] - The postfix to display on the message, such as "tested"
* @param {Function} [options.versionFormatter=versionColor] - The function to use to format the color of the badge based on the version number
* @param {boolean} [options.forcePrerelease] - Whether to force the badge to be considered a prerelease for cases where upstream API indicates a prerelease version but it is not semantically a prerelease
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably just call this isPrerelease

The way I'd view this is not so much that we're allowing platforms to indicate that a semantically stable release is actually a pre-release. More just that it allows a platform to explicitly indicate a release is a pre-release rather than us having to try and infer it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its probably for the better, our goal is to serve from upstream rather then infer our own conclusion.
Changed with c6714e3

@jNullj jNullj requested a review from chris48s November 10, 2024 20:52
@chris48s chris48s added this pull request to the merge queue Nov 11, 2024
Merged via the queue into badges:master with commit 04638ab Nov 11, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers developer-experience Dev tooling, test framework, and CI javascript [dependabot only] Pull requests that update Javascript packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure consistent usage of renderVersionBadge
2 participants