0.1.0 • Published 3 years ago
@kurone-kito/nodejs-versions-list v0.1.0
🟨 @kurone-kito/nodejs-versions-list
: JSON of Node.js versions list
Getting a list of Node.js versions can sometimes be a pain. Typically, you can parse the official dist to get it, but you may want to get the version number more easily.
There is also a handy library for this purpose,
all-node-versions
.
The @kurone-kito/nodejs-versions-list
library pre-parses the
results of his library into JSON so that you can get a list of
versions of this package at the time you installed it.
System requirements
- Node.js >= 14.17
Usage
First, you should install this package in your project.
npm install @kurone-kito/nodejs-versions-list
yarn add @kurone-kito/nodejs-versions-list
And, that’s all!
import list from '@kurone-kito/nodejs-versions-list';
console.log(JSON.stringify(list.versions));
console.log(JSON.stringify(list.majors));
Since the body is JSON, you need to specify the resolveJsonModule
flag if you want to use it in your TypeScript project.
See the all-node-versions package’s document for the JSON structure.
interface AllNodeVersionsReturns {
/**
* List of Node.js major releases sorted from the most to the
* least recent. Each major release has the following properties.
*/
majors: {
/**
* Latest version for that major release,
* as a `major.minor.patch` string.
*/
latest: string;
/**
* LTS name, lowercased. `undefined` if the major release is not LTS.
*/
lts?: string;
/** Major version number. `0` for old releases `0.*.*`. */
major: number;
}[];
/**
* List of available Node.js versions sorted from the most to the
* least recent. Each version is a `major.minor.patch` string.
*/
versions: string[];
}
Install the dependencies
npm ci
Linting
npm run lint
Build
npm run prepack
License
MIT
0.1.0
3 years ago