Skip to content

[ls-remote] only list active and/or maintained versions #3250

Open
@ryenus

Description

@ryenus

What happened?

Currently nvm ls-remote --lts literally list all the LTS versions, including the ones are no longer in active and/or maintenance status.

What did you expect to happen?

The most common usage of nvm ls-remote is to check for new versions, which is only relevant for currently supported versions, namely the ones in active and/or maintenance phases.

Therefore it would make sense to allow one to only list the currently supported versions, or to exclude the no longer supported versions.

If the default behavior cannot be changed, it would make sense to introduce certain command line options, such as --supported or --no-supported.

And we can use awk to parse the nodejs release schedule json to find supported versions, with end date later than the current date, for example:

$ curl -sL https://raw.githubusercontent.com/nodejs/Release/main/schedule.json |\
  awk -vT=$(date +%F) '{if($1~/v[0-9]+/){v=$1;gsub(/[":]/,"",v);while($1!~/end/)getline;
  e=$2;gsub(/[",]/,"",e);if(e>=T)print v,e}}'
v18 2025-04-30
v20 2026-04-30
v21 2024-06-01
v22 2027-04-30
v23 2025-06-01
v24 2028-04-30

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions