-
Notifications
You must be signed in to change notification settings - Fork 26
Prerelease bump not working in conjunction with NuGet #39
Comments
Thanks! The quote you copied does seem to identify that the identifier is dot separated, must not have leading zeros (against the NuGet style) and has examples for the supported format:
If you have a version To confirm this with pure semver: var semver = require('semver');
var version = '1.2.0';
var prerelease = semver.inc(version, 'prerelease', 'testAlpha');
console.log(prerelease); // 1.2.1-testAlpha.0
var prerelease = semver.inc(prerelease, 'prerelease');
console.log(prerelease); // 1.2.1-testAlpha.1
var patchOver = semver.inc(prerelease, 'patch');
console.log(patchOver); // 1.2.1 |
Thanks for the prompt reply. As I pointed out, the NuGet versioning scheme does follow the SemVer requirements by taking advantage of putting the number as part of the alphanumeric preid identifier. The difference is that there is no Note that there are also examples of this versioning scheme (which again is SemVer compliant) on the git tag documentation. The problem is that there doesn't seem to be a way to configure gulp-bump to increment the pre-release number with this scheme. I am able to work around it by passing the version from the CI server into the version parameter, but it would be nice if there were a way to change the format of the number to support this (SemVer compliant) scheme so pre-releases can be bumped from the command line. As a feature request, I would suggest to add a pre-release format string as an option that would default to your current scheme, but be changeable to other schemes (and understand how to pad with leading zeros, or alternatively just default to a zero-padded 5-digit number to cover the worst case scenario when not separated from the preid with a
Another (much simpler) way might be to just have a Boolean argument that specifies whether or not to include the final |
Bumping this to check update. :) +1 for @NightOwl888 suggestion. |
If semver supports it then I will add it. |
I stand by my original reply. The NuGet version scheme _is_ SemVer compliant. I have already included links to the relevant documentation and 2 potential solutions to solve this. And as @ankitbko pointed out, the demand for this is about to go up drastically now that ASP.NET 5 will be supporting |
@NightOwl888 I found a way to increase pre-release build using DNX_BUILD_VERSION environment variable. |
@ankitbko - Thanks for the info. It doesn't apply to my project because I am using gulp-bump in a build script for a jQuery plugin to be released by NuGet, NPM, Bower, and CDN. But I am sure posting the information about DNX_BUILD_VERSION here will help someone. |
@NightOwl888 I would love to support all possible versioning specs. As the semver.org spec outlines:
Padding is not valid as per the spec.
If they supported it, then what is currently added should work https://github.com/stevelacy/gulp-bump/blob/master/index.js#L83 with probably an option for the separator. I only could see the git tag example as an example for a non dot (.) or plus (+) separated pre-release version number. As such any changes to |
NuGet _does not use_ any dot-separated pre-release version identifiers (which I agree may not contain any zero padded numbers). The NuGet pack command will fail if it encounters one.
Per the NuGet documentation:
NuGet is taking advantage of the fact that a non-numeric identifier can end with numbers:
Since this is the slot they are putting the numbers into, they can be padded with zeros. The Non-Numeric Identifier spec supports [0-9], so there is absolutely nothing wrong with this. The reason for the padding is because NuGet uses lexicographic ASCII sort order when comparing pre-release version numbers, and since we don't always know how many versions we will have in advance it is safer to pad with 3-5 digits total (or allow the user to be able to specify the number of digits) to ensure the versions are always compared properly. As I mentioned in my original post, there are typically no additional hyphens (and definitely no periods) in the NuGet supported format. Ideally, gulp-bump would have an option to bump the numeric portion of the format. Therefore, a bump for each of these pre-release numbers:
Should result in the following:
As for the reasoning why NuGet does this - I am guessing it is because they are merging the version number with the traditional 4-segment numbers that Microsoft has used for at least 25 years ( You are welcome to contact the NuGet team to see if getting them to support numeric identifiers is a possibility. However, keep in mind that NuGet has been around for 5 years - so even if it is possible to get them to change this, there is still the matter of supporting the existing NuGet versions.
The NuGet versioning scheme is still SemVer compliant. So, the semver validation will still work. There just needs to be a way to parse and then increment the version number in the preid, and then return the new preid with the rest of the version. That could potentially be done with a regex replace. This could be done without calling Alternatively, parse the number out of the string and convert it to the existing
It would seem that this needs to be a special case, so it would be reasonable to add some kind of option to specify as NuGet version scheme. |
I agree with @NightOwl888. Nuget is SemVer compliant. If you are still worried, adding this as an option will not really break the underlying concept of gulp-bump. |
Rather busy, haven't gotten around to adding the option. Anyone up for it? |
Was hoping gulp-bump would solve my ASPNET 5 NuGet versioning hell. No joy it seems :-( |
PR? |
I would love to, but unfortunately time pressures are forcing me down the Given up on marking the packages as pre-release with a build number, and Will try to come back to it later if I have time On Thu, 28 Jan 2016 at 7:05 PM, Steve Lacy notifications@github.com wrote:
|
I submitted a PR to NuGet to see if they would conform to SemVer. |
@BertCotton excellent! |
Great library.
I am having some issues interoperating with NuGet because NuGet expects the pre-release format to be something like.
According to SemVer these are supposed to be supported.
But there is a twist with using them in NuGet - you cannot put a
.
in the pre-release part of the version. I found that you have a preid option that allows you to specify "alpha", etc. but there doesn't seem to be any way to remove the period after the identifier. I guess NuGet is leveraging the fact that the part after the period is optional and the identifier must be alphanumeric (meaning it can contain a version number).It is also a NuGet convention to pad the number with leading zeros so the version comparison logic works right. Otherwise
1.0.0-alpha9
will be a higher version than1.0.0-alpha10
.There also seems to be an issue with the way you implemented the preid - if it is not supplied to the command, but it does exist in the
.json
file it will be removed instead of bumping the version. But according to the spec it is required during pre-release, so this logic is invalid.It would be nice if you could fix this. Fortunately other than the pre-release stage it works great. Thanks.
The text was updated successfully, but these errors were encountered: