Giter Club home page Giter Club logo

Comments (5)

PyvesB avatar PyvesB commented on August 15, 2024 2

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.

PyvesB avatar PyvesB commented on August 15, 2024

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.

n-aspen avatar n-aspen commented on August 15, 2024

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.

n-aspen avatar n-aspen commented on August 15, 2024

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"

image

from shields.

chris48s avatar chris48s commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.