Skip to content

Commit

Permalink
Effectively make stable an alias for lts. (Solves issue #335)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Oct 27, 2017
1 parent f2e8425 commit 840accd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Simply execute `n <version>` to install a version of `node`. If `<version>` 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 or the right arrow key to select. Use ^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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -124,15 +120,13 @@ 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 <version> Install node <version>
n use <version> [args ...] Execute node <version> with [args ...]
n bin <version> Output bin path for <version>
n rm <version ...> 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

Expand Down Expand Up @@ -161,6 +155,7 @@ Output can also be obtained from `n --help`.
use as
list ls
- rm
stable lts

## Custom source

Expand Down
15 changes: 8 additions & 7 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@ 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 <version> Install node <version>
n use <version> [args ...] Execute node <version> with [args ...]
n bin <version> Output bin path for <version>
n rm <version ...> 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
Expand Down Expand Up @@ -197,6 +195,7 @@ display_help() {
use as
list ls
- rm
stable lts
EOF
}
Expand Down Expand Up @@ -505,6 +504,7 @@ install_latest() {

#
# Install latest stable version.
# (See additional comments for display_latest_stable_version)
#

install_stable() {
Expand Down Expand Up @@ -697,15 +697,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 "</a>" \
| 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
}

#
Expand Down

0 comments on commit 840accd

Please sign in to comment.