2.0.0 • Published 11 months ago

versions-checker v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
11 months ago

Versions Checker

npm npm npm npm npm

GitHub tag GitHub release GitHub issues GitHub pull requests GitHub license

Build Status Build status codecov Quality Gate Lines of Code

Bugs Code Smells Critical Violations Blocker Violations Technical Debt Ratio

Security Ratings Reliability Ratings Maintainability Ratings

node Dependencies Dev Dependencies Optional Dependencies

GitHub forks GitHub stars GitHub watchers

introduction

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
    -k  --karma [version]   check karma version
        --gulp [version]    check gulp version
        --grunt [version]   check grunt version
    -e  --eslint [version]  check eslint version
    -t  --tslint [version]  check tslint version
        --nvm [version]     check nvm version
        --n-mac [version]   check n 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",
  karma: "<1.7",
  gulp: "1",
  grunt: "1.5",
  eslint: "1.5.6",
  tslint: ">=1.4",
  nvm: "=1.5",
  n: "=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",
  karma: "<1.7",
  gulp: "1",
  grunt: "1.5",
  eslint: "1.5.6",
  tslint: ">=1.4",
  nvm: "=1.5",
  n: "=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

Karma (-k|--karma)

  • checks which version of karma is being used, and compares it with user input version.
    $ versions-checker --karma "1"
        karma: 1.6.0
    $ versions-checker -k "<1.7"
        karma: 1.6.0

gulp (--gulp)

  • checks which version of gulp is being used, and compares it with user input version.
    $ versions-checker --gulp ">=3.5"
        gulp: 1033083.9.1

grunt (--grunt)

  • checks which version of grunt is being used, and compares it with user input version.
    $ versions-checker --grunt "2"
        grunt: 1.2.0 but expected is 2
    $ versions-checker --grunt "1"
        grunt: 1.2.0

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

tslint (-t|--tslint)

  • checks which version of tslint is being used, and compares it with user input version.
    $ versions-checker -t "5"
        tslint: 5.7.0
    $ versions-checker --tslint "5.7"
        tslint: 5.7.0

nvm (--nvm)

  • checks which version of npm is being used, and compares it with user input version.
    $ versions-checker --nvm "5"
        nvm: 4.21.9 but expected is 5
    $ versions-checker --n-mac "4"
        nvm: 4.21.9

n (--n-mac)

  • checks which version of npm is being used, and compares it with user input version.
    $ versions-checker --n-mac "3"
        n: 2.1.7 but expected is 3
    $ versions-checker --n-mac "2"
        n: 2.1.7

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.

2.0.0

11 months ago

1.5.0

6 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago