Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

version-manage

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

version-manage

Manage npm / node version strings

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

version-manage

Manage semantic versioned versions, version 0.1.0

How to use

It's really simple, version manage has 3 methods (which can be chained)

Initialising
var VersionManager = require('version-manage');
var packageJson = require('./package.json');
var Manager = new VersionManager(packageJson.version);
Manager.version

Returns the current version as a string. This will update after every .increment() and .decrement().

console.log(Manager.version); // 0.1.0
Manager.increment(type)

You can increment by calling Manager.increment(type) where type is

  • major (THIS.x.x)
  • minor (x.THIS.x)
  • patch (x.x.THIS)
console.log(Manager.version) // 1.0.0
Manager.increment('patch');
console.log(Manager.version) // 1.0.1

PROTIP: Manager.bump(type) is an alias for increment.

Manager.decrement(type)

You can increment by calling Manager.decrement(type) where type is

  • major (THIS.x.x)
  • minor (x.THIS.x)
  • patch (x.x.THIS)
console.log(Manager.version) // 5.7.2
Manager.decrement('major');
console.log(Manager.version) // 4.7.2
Manager.write(path, callback)

You can write to your package.json by specifying the package.json path and an optional callback

console.log(Manager.version) // 1.3.0
Manager.increment('patch'); // 1.3.1
Manager.write('./package.json', function () { console.log('Success!'); });

Or you can chain them:

Manager.increment('patch').write('./package.json');

Keywords

FAQs

Package last updated on 19 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc