feat: trim leading v in versions

This commit is contained in:
Erica Marigold 2024-11-10 20:46:01 +05:30 committed by GitHub
parent fa8452ecd9
commit 4c2d25485d
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -91,7 +91,7 @@ local PRERELEASE_LEX_ORDER: { [PreleaseType]: number } = {
} }
function Semver.parse(ver: string): SemverResult<SemverImpl> function Semver.parse(ver: string): SemverResult<SemverImpl>
local components = string.split(ver, ".") local components = string.split(if stringStartsWith(ver, "v") then string.sub(ver, 2) else ver, ".")
if #components < 3 then if #components < 3 then
return Result.Err({ return Result.Err({
msg = Option.Some(`Expected MAJOR.MINOR.PATCH format, missing {#components} / 3 components`), msg = Option.Some(`Expected MAJOR.MINOR.PATCH format, missing {#components} / 3 components`),