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 = const versions =
versions
is an array like:
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 >=66.0.08.15.010.15.111.10.0
or with options:
$ get-versions --lts6.0.08.15.010.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
.