unascribed / FlexVer

A SemVer-compatible intuitive comparator for free-form versioning strings as seen in the wild, designed to sort versions like people do.
Creative Commons Zero v1.0 Universal
64 stars 10 forks source link

Proposal: ignore 'v' prefix #15

Open comp500 opened 1 year ago

comp500 commented 1 year ago

Quite a few version numbers seen in the wild are prefixed with v, e.g. v1.0.0. I think that these should compare equal to versions without, so v1.0.0 == 1.0.0, such as by stripping an initial textual component containing only v. This is particularly important for Modrinth version numbers, where authors occasionally forget to add the v (or intentionally change version format to add/remove it).

unascribed commented 1 year ago

I've been considering additional rules to adjust for slight mismatches between components like this, including some other weird cases... that I can't remember right now. The idea being if there was a "significant" amount of components that match exactly, the entire RHS would be shifted over by one or two components.

sylv256 commented 1 year ago

This is particularly important for Modrinth version numbers, where authors occasionally forget to add the v (or intentionally change version format to add/remove it).

Why would you add a v? I never use v in my Modrinth versions, as it does not reflect the real version.

comp500 commented 1 year ago

I probably didn't word that quite right - I don't personally add (and wouldn't suggest adding) a v prefix, but if an author normally uses a v prefix but sometimes doesn't add it, the versions will be out of order when sorted using FlexVer. Some version conventions do use a v prefix, particularly Git tags, so they are used in Modrinth version numbers (e.g. from a CI pipeline publishing GitHub releases to Modrinth)