Skip to content
/ nv Public

Tool for getting node versions by common aliases

License

Notifications You must be signed in to change notification settings

pkgjs/nv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ee7a4b9 · Oct 19, 2023

History

37 Commits
Aug 28, 2020
Dec 1, 2021
Oct 19, 2023
Dec 1, 2021
Jan 20, 2022
Sep 27, 2019
Oct 19, 2023
Aug 28, 2020
Aug 28, 2020
Aug 28, 2020
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023

Repository files navigation

Get information about Node.js versions

NPM Version NPM Downloads js-standard-style CI Test

This repository is managed by the Package Maintenance Working Group, see Governance.

Usage

$ npm i @pkgjs/nv
const nv = require('@pkgjs/nv')

(async () => {
  const versions = await nv('lts')
  console.log(versions)
  /*
[
  {
    "version": "18.18.2",
    "major": 18,
    "minor": 18,
    "patch": 2,
    "tag": "",
    "codename": "hydrogen",
    "versionName": "v18",
    "start": "2022-04-19T00:00:00.000Z",
    "lts": "2022-10-25T00:00:00.000Z",
    "maintenance": "2023-10-18T00:00:00.000Z",
    "end": "2025-04-30T00:00:00.000Z",
    "releaseDate": "2023-10-13T00:00:00.000Z",
    "isLts": true,
    "files": [
      "aix-ppc64",
      "headers",
      "linux-arm64",
      "linux-armv7l",
      "linux-ppc64le",
      "linux-s390x",
      "linux-x64",
      "osx-arm64-tar",
      "osx-x64-pkg",
      "osx-x64-tar",
      "src",
      "win-x64-7z",
      "win-x64-exe",
      "win-x64-msi",
      "win-x64-zip",
      "win-x86-7z",
      "win-x86-exe",
      "win-x86-msi",
      "win-x86-zip"
    ],
    "dependencies": {
      "npm": "9.8.1",
      "v8": "10.2.154.26",
      "uv": "1.44.2",
      "zlib": "1.2.13.1-motley",
      "openssl": "3.0.10+quic"
    }
  }
]
  */
})()

You can also pass an array of aliases and the resulting array will be sorted and de-duped, for example:

const versions = await nv(['lts', 'supported'])
console.log(versions.map((v) => v.version))
/*
[ '8.16.1', '10.16.3', '12.11.0' ]
*/

Supported Aliases

Support Aliases

For now referenced here until we have a more official doc: nodejs/package-maintenance#236 (comment)

  • all: All node versions
  • lts_active: Head of LTS and Active major version lines
  • lts: Head of current LTS lines
  • active: The newest version in the active but not maintenance mode lines
  • lts_latest/lts/*: Latest of the LTS lines (lts/* for nvm compatibility)
  • supported: Head of all maintained lines
  • DEPRECATED maintained: Head of all maintained lines
  • current/node: Newest of all maintained lines (node for nvm compatibility)

Version Aliases

  • v6, v8, v10, v12, etc: Head of major version line by version number
  • dubnium, carbon: Named alias for LTS lines