-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow prerelease versions when parsing release entries #450
Conversation
/cc @kevinsawicki @nathansobo - This is trying to address Atom's issues w/ Squirrel on our Beta channel. |
@@ -9,39 +10,19 @@ namespace Squirrel | |||
{ | |||
public static class VersionExtensions | |||
{ | |||
public static Version ToVersion(this IReleasePackage package) | |||
private static readonly Regex _suffixRegex = new Regex(@"(-full|-delta)?\.nupkg$", RegexOptions.Compiled); |
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.
You don't usually need the private
keyword in C#, the default visibility is "as private as possible"
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.
Noted. I was copying NuGet
's style here with these static Regex
instances.
Good to hear someone is picking this up again, well done. However... The string replacements were there for a reason. In your case, it means 1.0-unstable123 is higher than 1.0-beta1. Is that really what you want? How are you handling unstable, alpha and beta? I think stuff like "unstable" and "nightly" should never be considered higher than alpha or beta. And since alpha is the first letter, it's hard to find something that comes in before that that makes sense to end users. From what I remember, NuGet's logic also is case sensitive, so "1.0.0-unstable15" is lower than "1.0.0-Unstable14". So please be very careful when using something that is written for NuGet... Note that all situations were covered with unit tests in my PR as well, so not sure why Paul didn't accept it. Hopefully yours will be accepted. And now we are at it. I also added a feature (to my custom branch) that adds the release date. This is very useful in lots of scenarios (showing how long a release has been out and the user is still not on that release, or for license checking scenarios). It's a simple (non-breaking) addition since the parser can just assume null when a release date is unknown (old behavior). |
Yeah, I can't see any reason why
Here is what return StringComparer.OrdinalIgnoreCase.Compare(SpecialVersion, other.SpecialVersion); Admittedly, they aren't exactly the same. NuGet's logic is case-insensitive, whereas semver stipulates ASCII-order (capitals first). Also, NuGet requires that pre-release names start with letters and don't contain any dots. Overall though, I think that matching NuGet's behavior is an appropriate way for Squirrel to deal with pre-releases. |
I'm just as apprehensive now as I was then but this is a blocking bug for Atom's beta program so we're going to try it and see who gets broken. To be clear, I've never been apprehensive about the approach, only the unintended consequences that it could have. Updating software seems easy but is Very Tricky. |
Then I am still wondering how atom will handle nightlies and betas. What names will you be using? |
If we ever do nightlies, they'll always be for the next version. So if the latest beta is |
Yes, and how are you going to release 1.3.0-beta-1? Anyway, I solved this by using alpha as nightly builds. |
If I understand your question correctly, as soon as |
But according to semver, 1.3.0-beta-1 is smaller than 1.3.0-unstable-1 or 1.3.0-dev-1 |
That is correct. If you need metadata in the version that doesn't affect precedence, you need to use the build metadata hash |
Keep in mind that there's an open PR to change the comparison of labels to be case insensitive. I'm inclined to accept this PR but the person who submitted is no longer on the NuGet team and I've been very busy with other stuff. |
Allow prerelease versions when parsing release entries
Thanks @maxbrunsfeld! |
⚡ Thanks for throwing me a 🍖 on this. |
I'll put out a release on Monday or so |
Fixes #449
Fixes #93
@paulcbetts I'm opening this now so that you can 🔫 it down sooner rather than later.
Overview
My strategy here is to avoid changing the format of
RELEASES
. The-delta
and-full
suffixes are still used to denote delta vs full packages, but semver pre-release strings are also allowed.Unlike @GeertvanHorrik's proposed solution, I'm just relying on
NuGet.SemanticVersion
and its built-in ordering relation (prerelease versions are sorted alphabetically). No hard-coded orderings of specific prerelease strings.Status
master
, and the same twenty fail against this branch.