Skip to content
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

Multiple types of versions #195

Open
yosiat opened this issue Dec 31, 2016 · 2 comments
Open

Multiple types of versions #195

yosiat opened this issue Dec 31, 2016 · 2 comments

Comments

@yosiat
Copy link

yosiat commented Dec 31, 2016

Hi,

First of all, grunt-bump is totally amazing! In my app we have both production and staging, we want to use grunt-bump to manage versions in both environments.

Currently I see that grunt-bump support only one environment, how can I overcome this?

Another question: I see that grunt-bump takes the latest version from package.json, If I have no version their, it doesn't work and I expect grunt-bump to take latest version from latest git tag.

@mojoaxel
Copy link
Collaborator

mojoaxel commented Jan 1, 2017

@yosiat Could you please describe in more detail what you would expect from grunt-bump in your case. Maybe you also could explain your development process step by step. How a software can have multiple version at one time is not clear to me.

Trying to get a semver number from the last git tag is a nice idea for an enhancement.

@edthorne
Copy link

I think you're encountering the same issue that I am. When matching the version number, if the prereleaseName value does NOT appear in the version string, it won't match a prerelease version and will increment only the version. Here's an example of what happens currently:

1.0.0-dev.0
bump:prerelease (prereleaseName = dev)
1.0.0-dev.1
bump:prerelease (prereleaseName = rc)
1.0.1-rc.0
bump (prereleaseName != rc)
1.0.2

The reason for this is the inclusion of the prereleaseName option value in the regular expression rather than generically matching any prereleaseName value found in a semantic version string.

My desired behavior, and what I think you're asking for, should be as follows:

1.0.0-dev.0
bump:prerelease (prereleaseName = dev)
1.0.0-dev.1
bump:prerelease (prereleaseName = rc)
1.0.0-rc.0
bump (prereleaseName = dev)
1.0.0

You can work around the final bump by ensuring the prereleaseName matches 'rc' for final builds. The dev to rc transition has to be done by hand when branching for the release build.

OR

Use a custom regExp setting to avoid the exact matching of prereleaseName:

regExp: new RegExp('([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)(\\d+\\.\\d+\\.\\d+(-[\\w\\d\\-\\.]+\\.\\d+)?(-\\d+)?)[\\d||A-a|.|-]*([\'|\"]?)')

I think the default behavior should not include the prereleaseName in the regular expression allowing version matching to match any prerelease version. The semver API call handles transitions from dev to rc without incrementing any of the major, minor, patch values.

Here's an example project:
bump.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants