-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed regex for matching versions #253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for context, related to mamba-org/mamba#3638 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add tests?
src/options.ts
Outdated
@@ -295,7 +295,7 @@ export const getOptions = () => { | |||
), | |||
micromambaVersion: parseOrUndefined( | |||
'micromamba-version', | |||
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+-\d+$/)]), | |||
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match PEP440 version numbers of release candidates, alphas, and betas (for instance 2.0.0rc0
):
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]), | |
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d+)?-\d+$/)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work. I think it's rather ^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$
(yes, I let you find the single character I had to change :D)
My bad, I entered wrong matches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go. :)
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]), | |
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$/)]), |
src/options.ts
Outdated
@@ -295,7 +295,7 @@ export const getOptions = () => { | |||
), | |||
micromambaVersion: parseOrUndefined( | |||
'micromamba-version', | |||
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+-\d+$/)]), | |||
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add dev
as well since it was added here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also bump
Line 3 in c8d39fb
"version": "2.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @JohanMabille.
No description provided.