Last Updated: September 14, 2016
·
2.959K
· mikaelbr

mversion - A cross packaging manager module version handler

Updated April 26th 2014 to reflect module changes

I use npm version to bump versions on NPM modules and creating tags (https://coderwall.com/p/9bx-iq). But when working on a module that also is a Bower component, I can't use npm version, so I have to manually bump versions in both package.json and component.json. This is a tedious task, even if only using component.json.

I developed mversion to help me automate this task. mversion works almost the same as npm version does.

Supported module configurations

  • package.json
  • npm-shrinkwrap.json
  • component.json
  • bower.json
  • manifest.json
  • *.jquery.json (jquery plugin files, e.g plugin.jquery.json)

Usage

Install by using NPM:

npm install -g mversion

See usage of mversion by doing mversion -h.

Usage: mversion [ <newversion> | major | minor | patch | build ] [ -m <optional message> ]
(run in package dir).

Update module version in both package.json and component.json.

Run without arguments to get current version.

# Update version
Update version by defining new semver valid version
or a release string (major, minor, patch, build).
--
Ex: "mversion minor"
Ex: "mversion 1.0.1-beta"
--

# Git
Use -m to auto commit and tag. Apply optional message and
use '%s' as placeholder for the updated version. Default
message is 'v%s' where %s is replaced with new version.
--
Ex: "mversion minor -m"
Ex: "mversion minor -m 'Bumped to v%s'"
--

Examples

$ mversion patch
New Version: 0.0.6
Updated package.json
Updated component.json

$ mversion 0.0.5 -m
New Version: 0.0.5
Updated package.json
Updated component.json
Updated someplugin.jquery.json

Commited to git and created tag v0.0.5


$ mversion 1.0.0-rc1 -m "Now in wopping v%s"
New Version: 1.0.0-rc1
Updated package.json
Updated component.json
Commited to git and created tag v1.0.0-rc1

See source code at Github: https://github.com/mikaelbr/mversion

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside