Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effectively make stable an alias for lts. (Solves issue #335) #467

Merged
merged 1 commit into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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

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 @@ -514,6 +513,7 @@ install_latest() {

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

install_stable() {
Expand Down Expand Up @@ -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 "</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