Comments (5)
Thanks for digging that out! I'd foresee two issues with following a similar approach:
- if the ranges are broken down in too many parts due to unsupported game versions here and there, the badge would still risk being too long.
- we'd need to keep track of all known game versions, and make sure the listing is updated on a regular basis.
I'll let other maintainers weigh in, but I'd personally be in favour of a simpler and more robust solution, e.g. something ellipsis-based like 1.17 | 1.18 | ... | 1.19 | 1.19.1
.
from shields.
Hello @n-aspen 👋🏻
Thanks for reporting, that badge is indeed very long. 😄
The API doesn't seem to be returning any range info, just a list of versions. If we get ["1.17", "1.18", "1.18.1", "1.18.2", "1.19"]
back, one may be tempted to conclude that the range is 1.17-1.19
, but that's technically not quite correct as version 1.17.1 is missing from the list. I'm wondering whether the Modrinth website handles these cases correctly.
A less elegant but more robust solution would be to put an ellipsis in the middle, e.g. 1.17 | 1.18 | ... | 1.19 | 1.19.1
when there are for example five or more versions returned by the API.
from shields.
That's probably a reasonable solution for 90% of use cases tbh. Most of the time a project will support a lower and upper bound for versions.
I wanted to see how Modrinth handled it as their website is open source, and I think this is it? I'm not completely certain though, and best as I can tell it'd be way out of scope for this.
from shields.
I found a definitive answer to this question
I'm wondering whether the Modrinth website handles these cases correctly.
This plugin 1u6JkXh5, has an old-ish release that only has 1.17.1, 1.18.2, 1.19.4-1.20.4
marked as supported, which matches this list in the API, where it's only made a range out of the 1.20.x
entries because they're listed individually.
0 "1.17.1"
1 "1.18.2"
2 "1.19.4"
3 "1.20"
4 "1.20.1"
5 "1.20.2"
6 "1.20.3"
7 "1.20.4"
from shields.
Ellipsis is definitely the easiest thing to do, and it puts a cap on the length. There are going to be some situations where it is not that helpful
There is a Modrinth API endpoint which gives all the available game versions. https://api.modrinth.com/v2/tag/game_version
curl "https://api.modrinth.com/v2/tag/game_version" | jq '[.[] | select(.version_type == "release") | .version]'
We could potentially use that to work out if a list of supported game versions on a project can be displayed as a range. It would be an extra API request, but we could do them in parallel or cache the game_version
call.
from shields.
Related Issues (20)
- Funkwhale badges HOT 6
- Pre-release filter for Maven Central HOT 1
- App Center badges HOT 3
- Buildkite badges HOT 1
- Clayton badges HOT 1
- Node 22 CI workflows failing HOT 2
- CodeScene badges HOT 2
- deepscan badge HOT 4
- Deepsource badges HOT 3
- Project Discovery Badges HOT 2
- Chinese translating HOT 2
- GitHub Lines Of Code badge HOT 2
- Cache and case in parameter Url HOT 1
- MDN HTTP Observatory is launched, and Mozilla Observatory is now deprecated. HOT 5
- Wheelmap badges broken HOT 3
- Pivotal Tracker badges
- Cross-Origin-Resource-Policy not set
- Why is the windows logo gone? HOT 2
- Add ability to format bytes as metric (e.g: kilobyte) or IEC (e.g: kibibyte) format HOT 6
- Go modules showing the same version number HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shields.