versions-checker
Check installed versions of node, npm, yarn, and git
Project maintained by sridharmallela
Hosted on GitHub Pages — Theme by mattgraham
Versions Checker
Check installed versions of node, npm, yarn, and git
Table of Contents
Installation
Global CLI
$ npm install -g versions-checker
Non CLI
$ npm install --save-dev versions-checker
Usage
$ versions-checker --help
Usage: versions-checker [options]
Options:
--version output the version number
--all lists all installed versions
-s --silent will not exit even versions match
-n --node [version] check node version
-m --npm [version] check npm version
-y --yarn [version] check yarn version
-g --git [version] check git version
-e --eslint [version] check eslint version
-h, --help output usage information
Examples:
$ versions-checker --node ">=4.2.1"
$ versions-checker --help
Non CLI
var checker = require("versions-checker");
// returns boolean
const isValid = checker.validate({
node: ">=6.9.5",
npm: ">1",
yarn: "0.24 || 0.25",
git: "2.14",
eslint: "1.5.6"
});
const isNodeValid = checker.validate({ node: "6.9.5" });
const versions = checker.checkAll();
console.log("node version is " + versions.node);
console.log("npm version is " + versions.node);
import { validate, checkAll } from "versions-checker";
// returns boolean
const isValid = validate({
node: ">=6.9.5",
npm: ">1",
yarn: "0.24 || 0.25",
git: "2.14",
eslint: "1.5.6"
});
const isNodeValid = validate({ node: "6.9.5" });
const versions = checkAll();
console.log("node version is " + versions.node);
console.log("npm version is " + versions.node);
NPM Script
// package.json
{
"scripts": {
"check-versions": "./node_modules/.bin/versions-checker --node \">=4\" --npm \">=2\""
}
}
$ npm run check-versions
> versions-checker --node ">= 4.0.0" --npm ">=2.0.0"
node: 6.9.5
npm: 5.2.0
validate
- validates input versions against actual versions installed.
checkAll
- prints all the installed versions.
Options
help (-h|–help)
- specifies how to use versions-checker
version (–version)
- specifies which version of versions-checker.
all (–all)
- specifies to print installed versions.
silent (-s|–silent)
- specifies to not exit command line if versions dont match.
node (-n|–node)
- checks which version of node is being used, and compares it with user input version.
$ versions-checker --node ">4.5"
node: 6.9.5
$ versions-checker --node "<4.5"
node: 6.9.5 but expected is <4.5
$ versions-checker --node 4
node: 6.9.5 but expected is 4
$ versions-checker --node 6
node: 6.9.5
$ versions-checker -n 6.9
node: 6.9.5
$ versions-checker -n 6.10
node: 6.9.5 but expected is 6.10
npm (-m|–npm)
- checks which version of npm is being used, and compares it with user input version.
$ versions-checker --npm ">=2.5.0"
npm: 5.2.0
$ versions-checker --npm ">2.5.0"
npm: 5.2.0
$ versions-checker -m ">2.5"
npm: 5.2.0
$ versions-checker -m "<5.3"
npm: 5.2.0
yarn (-y|–yarn)
- checks which version of yarn is being used, and compares it with user input version.
$ versions-checker --yarn "0.27"
yarn: 0.27.5
$ versions-checker -y "0.27.5"
yarn: 0.27.5
Git (-g|–git)
- checks which version of git is being used, and compares it with user input version.
$ versions-checker -g "2"
git: 2.14.1
$ versions-checker --git "2.14"
git: 2.14.1
eslint (-e|–eslint)
- checks which version of eslint is being used, and compares it with user input version.
$ versions-checker --eslint "4.5"
eslint: 4.5.0
$ versions-checker -e "4"
eslint: 4.5.0
Updating versions-checker
Global package:
$ npm uninstall -g versions-checker
$ npm cache clean
$ npm install -g versions-checker
License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.