How to update package.json version automatically ?

How to update package.json version automatically ?

Asked on October 24, 2018 in node.js.
Add Comment


  • 3 Answer(s)

    The perfect answer is npm version.

    In this grunt-bump is an alternative.

    It is maintained from angular.js.

    grunt bump
    >> Version bumped to 0.0.2
     
    grunt bump:patch
    >> Version bumped to 0.0.3
     
    grunt bump:minor
    >> Version bumped to 0.1.0
     
    grunt bump
    >> Version bumped to 0.1.1
     
    grunt bump:major
    >> Version bumped to 1.0.0
    
    Answered on October 24, 2018.
    Add Comment

    Try this:

    npm version patch =

    use the above instruction update package.json version automatically .

    Answered on October 24, 2018.
    Add Comment

    This wil be useful:

    npm version patch
    git add *;
    git commit -m "Commit message"
    git push
    npm publish
    
    • The first line, npm version patch, will increase the patch version by 1 (x.x.1 to x.x.2) in package.json.
    • Then we can add all files — including package.json which at that point has been modified.
    • Then, the usual git commit and git push, and finally npm publish to publish the module.
    Answered on October 24, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.