From 4491931be60e13a97aa80b812eafb36fd40953c5 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 28 Oct 2017 12:28:40 +1300 Subject: [PATCH] Effectively make stable an alias for lts. (Solves issue #335) --- README.md | 11 +++-------- bin/n | 15 ++++++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9382ec5f..46063c1a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Simply execute `n ` to install a version of `node`. If `` has $ n 0.9.6 Execute `n` on its own to view your currently installed versions. Use the up and down arrow keys to navigate and press enter to select. Use `q` or ^C (control + C) to exit the selection screen. -If you like vim key bindings during the selection of node versions, you can use `j` and `k` to navigate up or down without using arrows. +If you like vim key bindings during the selection of node versions, you can use `j` and `k` to navigate up or down without using arrows. $ n @@ -59,10 +59,6 @@ Use or install the latest official release: $ n latest -Use or install the stable official release: - - $ n stable - Use or install the latest LTS official release: $ n lts @@ -80,7 +76,7 @@ Alternatively, you can use `-` in lieu of `rm`: Removing all versions except the current version: ```bash -$ n prune +$ n prune ``` ### Binary Usage @@ -124,7 +120,6 @@ Output can also be obtained from `n --help`. n Output versions installed n latest Install or activate the latest node release n -a x86 latest As above but force 32 bit architecture - n stable Install or activate the latest stable node release n lts Install or activate the latest LTS node release n Install node n use [args ...] Execute node with [args ...] @@ -132,7 +127,6 @@ Output can also be obtained from `n --help`. n rm Remove the given version(s) n prune Remove all versions except the current version n --latest Output the latest node version available - n --stable Output the latest stable node version available n --lts Output the latest LTS node version available n ls Output the versions of node available @@ -161,6 +155,7 @@ Output can also be obtained from `n --help`. use as list ls - rm + stable lts ## Custom source diff --git a/bin/n b/bin/n index f98507f3..59748262 100755 --- a/bin/n +++ b/bin/n @@ -161,7 +161,6 @@ display_help() { n Output versions installed n latest Install or activate the latest node release n -a x86 latest As above but force 32 bit architecture - n stable Install or activate the latest stable node release n lts Install or activate the latest LTS node release n Install node n use [args ...] Execute node with [args ...] @@ -169,7 +168,6 @@ display_help() { n rm Remove the given version(s) n prune Remove all versions except the current version n --latest Output the latest node version available - n --stable Output the latest stable node version available n --lts Output the latest LTS node version available n ls Output the versions of node available @@ -197,6 +195,7 @@ display_help() { use as list ls - rm + stable lts EOF } @@ -514,6 +513,7 @@ install_latest() { # # Install latest stable version. +# (See additional comments for display_latest_stable_version) # install_stable() { @@ -706,15 +706,16 @@ display_latest_version() { # # Display the latest stable release version. +# Note: Stable is no longer used by nodejs to identify versions, +# so this could be considered deprecated. To avoid breaking +# existing usages and minimise code churn in meantime, +# return the lts version. +# lts is the version recommended for most users. # display_latest_stable_version() { check_io_supported "--stable" - $GET 2> /dev/null ${MIRROR[$DEFAULT]} \ - | egrep "" \ - | egrep -o '[0-9]+\.[0-9]*[02468]\.[0-9]+' \ - | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \ - | tail -n1 + display_latest_lts_version } #