Increments a version number string.
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.
$ node> var increment = require('version-incrementer').increment;> increment('0.5.7');'0.5.8'> increment('0.5.9');'0.6.0'> var incrementMajor = require('version-incrementer').incrementMajor;> incrementMajor('0.5.9');'1.0.0'> incrementMajor('3.5.1');'4.0.0'
Tests are included.
npm install version-incrementer