n-update-cli

0.1.0 • Public • Published

n-update

The missing update command for n

Installation

Since you probably already have node, the easiest way to install n-update is through npm or yarn:

$ npm -g install n-update
$ yarn global add n-update

Usage

You can run n-update from the command line.

Updating

To update to the latest version of Node, you can simply run the binary without any arguments. If you immediatly want to prune older versions, you can pass the --prune (or -p) option.

# Install the latest Node version, equivalent of `n latest` 
$ n-update
# Installed versions:
v10.16.0
+ v12.4.0
# Install the latest Node version and prune older installations, equivalent of `n latest && n prune` 
$ n-update --prune
# Installed versions:
- v10.16.0
+ v12.4.0

You can also update Node versions by keyword, like lts and latest, or update the currently active Node version with current or active.

n-update lts
# Installed versions:
- v10.10.0
+ v10.16.0
n-update current
# Installed versions:
- v9.5.0
+ v9.11.2

You can even update all installed Node versions, either by major or minor release, by using the --major (or -M) and --minor or -m options.

# Update all major Node versions 
$ n-update -M
# Installed versions:
- v10.10.0
+ v10.16.0
- v12.3.0
+ v12.4.0
# Update all minor Node versions 
$ n-update -m
# Installed versions:
- v10.15.0
+ v10.15.3
v12.4.0

Updating Specific Versions

You can update a specific version of node only, by passing the version you want to update.

# Update to the latest 10.x.x release 
$ n-update 10
# Installed versions:
v9.5.0
- v10.15.0
+ v10.16.0
# Update to the latest 10.15.x release 
$ n-update 10.15
# Installed versions:
v9.5.0
v10.0.0
- v10.15.0
+ v10.15.3

You can even update multiple versions at once.

$ n-update 10 12
# Installed versions:
v9.5.0
- v10.10.0
+ v10.16.0
- v12.3.0
+ v12.4.0
$ n-update 10.15 12
# Installed versions:
v9.5.0
v10.10.0
- v10.15.0
+ v10.15.3
- v12.3.0
+ v12.4.0

Pruning

You can immediately prune any older node versions by passing the --prune (or -p) option.

# Install the latest 10.x.x release, prune any older verions 
$ n-update 10 --prune
# Installed versions:
- v9.5.0
- v10.15.0
+ v10.16.0
v12.4.0
# Install the latest 10.x.x release, prune any older verions 
$ n-update 10.15 --prune
# Installed versions:
- v9.5.0
- v10.0.0
- v10.15.0
+ v10.15.3

Sometimes, you may want to prune outdated releases, but keep the latest majors installed. You can pass the --major (or -M) option to achieve this.

# Install the latest 10.x.x release, prune any older verions apart from the latest majors for each release. 
$ n-update 10 --major --prune
# Installed versions:
v9.5.0
- v10.15.0
+ v10.16.0
v12.4.0

If you want to keep all minor releases as well, and just prune patches, that's an option too, just pass the --minor (or -m) option to do so.

# Install the latest 10.x.x release, prune any older verions apart from the latest majors for each release. 
$ n-update 10 --minor --prune
# Installed versions:
- v9.2.0
v9.2.1
v9.5.0
- v10.15.0
v10.15.3
+ v10.16.0
v12.4.0

Lastly, if you wish to keep a specific patch, you can just pass the full version for that patch, and it won't be pruned.

$ n-update 10.15 10.15.2 --prune
# Installed versions:
- v10.10.0
- v10.15.0
v10.15.2
+ v10.15.3

Package Sidebar

Install

npm i n-update-cli

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

12.4 kB

Total Files

6

Last publish

Collaborators

  • cupoftea696