Skip to content

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.

License

Notifications You must be signed in to change notification settings

lukebond/version-incrementer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published