1.2.7 • Published 5 years ago

get-versions v1.2.7

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

downloads last commit Coverage Status travis node Gitter

Get the Node.js versions supported by your package.

This can be used when you want to perform an action on each Node.js version supported by your package, such as testing or using Babel.

Installation

$ npm install get-versions

Usage

const getVersions = require('get-versions')

const versions = getVersions(options)

versions is an array like:

["6.0.0", "8.15.0", "10.15.1", "11.10.0"]

The Node.js versions supported by your package are guessed from the engines.node field in your package.json.

Only the last release of each major Node.js version is returned. Exception: for the oldest major Node.js version, the first matching release is returned instead. This is done in order to cover the full versions range.

Usage (CLI)

$ get-versions >=6
6.0.0
8.15.0
10.15.1
11.10.0

or with options:

$ get-versions --lts
6.0.0
8.15.0
10.15.1

Options

options is an object with the following properties.

range {string}

Semver range used as main input. Defaults to the engines.node field in your package.json. It has the same syntax as that field, e.g. >=6.5.0 or 6 - 8.

deprecated {boolean}

If false (the default value), skip the versions not maintained by Node anymore, i.e. either old, or neither LTS nor current.

lts {boolean}

If true (default: false), only include LTS versions.

cwd {string}

Change the current directory, which is used to find your package.json.