-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix(utils): Ensure isPreviewRelease
identifies -dump
as a preview release
#561
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -104,7 +104,7 @@ export function versionGreaterOrEqualThan(v1: SemVer, v2: SemVer): boolean { | |||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||
* A regular expression to detect that a version is a pre-release version. | ||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||
export const PREVIEW_RELEASE_REGEX = /(?:[^a-z])(preview|pre|rc|dev|alpha|beta|unstable|a|b)(?:[^a-z]|$)/i; | ||||||||||||||||||||||||||||||||||||||
export const PREVIEW_RELEASE_REGEX = /(?:[^a-z])(preview|pre|rc|dev|alpha|beta|unstable|a|b|dump)(?:[^a-z]|$)/i; | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've never heard of "dump" as a prerelease naming scheme -- is this standardized anywhere? I'd prefer we use actual semver names rather than making up our own here (as that would be more expected from users as well when reasoning about versions) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I understand, I can also close this as I get your point. WDYT about checking for any suffix after the semver patch number instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok then we definitely shouldn't add this to the regex I think craft should reject any non-semver versions -- I thought it already did this but maybe that's only for python? the dotnet sdk release should have named it -pre1 or one of the standard naming schemes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one important case either way is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it looks like we would throw an error in the release registry target if we encounter a version string we can't parse to semver: Lines 43 to 45 in 413a603
the prepare command also throws if the new version is not semver-compliant: Lines 115 to 129 in 413a603
So theoretically, we could change the pre-release check to use I'll also double-check the python case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems fine to me! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok now the specific list of pre-releases makes sense: If we want to ensure Python post releases are not identified as pre-releases, we can't check against arbitrary pre-release version identifiers. So just checking for So I guess, we don't change anything 👍 I can open a PR with some tests I wrote to have the Python case covered. |
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||
* Checks that the provided string is a pre-release version. | ||||||||||||||||||||||||||||||||||||||
|
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.
added some more tests here for other suffixes