version-incrementer

Increments a version number string.

npm install version-incrementer
4 downloads in the last week
8 downloads in the last month

version-incrementer

Takes a version number string of the form 'major.minor.build' and increments it, wrapping the build number but not the minor number. Includes a separate method for incrementing the major number.

The build & minor numbers are incremented according to the following rules:

  • It will wrap the build number after 9, incrementing the minor number.
  • It won't wrap the minor number (ie. '10' is okay).
  • It won't wrap the major number (there's a separate method for that).

If the input isn't in the form x.y.z then it will just return the value that you pass in.

Inspired by mparke's increment-version, but works off a string rather than a file.

Example

$ node
> var increment = require('version-incrementer').increment;
undefined
> increment('0.5.7');
'0.5.8'
> increment('0.5.9');
'0.6.0'
> var incrementMajor = require('version-incrementer').incrementMajor;
undefined
> incrementMajor('0.5.9');
'1.0.0'
> incrementMajor('3.5.1');
'4.0.0'

Tests are included.

Installation

npm install version-incrementer

License

MIT

npm loves you