node-semver: CLI Tool for Semantic Versioning 2.0.0

In this post, I want to tell you about node-semver, a SemVer 2.0.0 parser command-line tool and a node.js library (the one that npm uses).
2016-04-14 16:47
Tugberk Ugurlu

This is yet another post from me on a tiny but a very useful tool. Last time, I have written about SqlLocalDB.exe Utility Tool which is a command-line tool to manage SQL Server Express LocalDB instances. Today, I want to tell you about node-semver, a SemVer 2.0.0 parser command-line tool and a node.js library (the one that npm uses). I am huge fan of SemVer. You cannot imagine how many places you can you use semantic versioning to make the internal and external communication easy for your software product. I plan to write more about a few different cases I figured out.

Going back to our topic, the acquisition of this tool is amazingly simple. You basically install this as a global npm package by running "npm install semver -g" and from there, you have access to semver command everywhere.


There are a lot of great things you can do with this but I will give you a few of the basic and useful samples. First useful thing I noticed was the ability to validate a string against a SemVer 2.0.0 spec.

Screenshot from 2016-04-14 16^%40^%13

If the validation fails, it exists with non-zero exit code.

Screenshot from 2016-04-14 16^%38^%41

You can also increment a version:


By default, it increments the patch version but you can customize this if you want:



One useful feature that I have been using is to giving bunch of string values to node-semver and getting back the valid semantic version strings back:


Notice that it doesn't only sanitize the input, it also orders the versions on the standard output which is very convenient. I have an upcoming blog post where I will show you how I leverage this feature and a few others for a legitimate use case.

Lastly, I want to give you an example on its range feature which allows you to check if a version (or which versions if multiple versions are given) satisfies a range check:


So, did you like it? I hear you screaming "YES!" :) So, go spread this amazing tiny utility by sharing this blog post. There are more but these examples should be enough to give you an idea.


ipad service center in Mumbai
by ipad service center in Mumbai on Friday, Sep 02 2016 12:03:37 +00:00
Nice post . keep up the good work!
BBA College in Punjab
by BBA College in Punjab on Thursday, Sep 08 2016 12:10:45 +00:00
Great Blog. I add this Post to my bookmarks.
Lakeside software
by Lakeside software on Thursday, Oct 06 2016 11:51:02 +00:00
SCS is focused on providing the most comprehensive, heterogeneous, integrated IT Software solutions to enterprises around the world.
by zapya on Tuesday, Oct 25 2016 11:17:05 +00:00
Download Zapya for PC to share files and folders easily from PC to other devices