GithubHelp home page GithubHelp logo

Comments (7)

AsaAyers avatar AsaAyers commented on June 30, 2024

I came here because I have the same problem from the other side.

If I'm on 0.1.2-rc.2 then the next non-prerelease bump should be to 0.1.2.

from node-semver.

isaacs avatar isaacs commented on June 30, 2024

Right, so inc() should always go up, and never down. This gets hairy around the cases where you have a patch and a prerelease.

I'd argue that the correct approach would be: inc("1.2.3", "prerelease") === "1.2.4-0" and inc("1.2.3-0", "patch") === "1.2.3"

from node-semver.

AsaAyers avatar AsaAyers commented on June 30, 2024

I think inc("1.2.3", "prerelease") === "1.2.4-0" is usually correct, but there are cases where you'd want the pre-release to bump the major or minor instead. What about inc("1.2.3", "preminor") === "1.3.0-0"? and a premajor to bump to 2.0.0-0?

#65 should address the 2nd issue, but the first seemed more complex, so I wasn't sure how to fix it.

from node-semver.

isaacs avatar isaacs commented on June 30, 2024

I think it's simpler to just that a bump to the prerelease will also bump the patch if there isn't already a prerelease.

from node-semver.

AsaAyers avatar AsaAyers commented on June 30, 2024

I'm not totally sure if I'm following. That should be what this PR is doing. I created a quick chart showing in red how semver is working now and in blue how this PR works.

selection_216

Maybe your objection is to including preminor and premajor? While they might be used less often I think they're needed. Using only semver's inc() it's impossible to reach 1.7.0-0 from 1.6.0: minor goes to 1.7.0 then prerelease goes to 1.7.1-0.

I think "Using only semver's inc()" is important because it gets used by other tools like grunt-release which will bump, commit, push. It defeats the purpose of such tools if I have to manually manipulate the version when generating a prerelease of a minor version.

from node-semver.

eddiemonge avatar eddiemonge commented on June 30, 2024

I believe this is now fixed with the introduction of prepatch, preminor, and premajor.

from node-semver.

isaacs avatar isaacs commented on June 30, 2024

Fixed on master.

from node-semver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.