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

[feature request] add the previous version in the output. #825

Open
vdegenne opened this issue Dec 15, 2024 · 3 comments
Open

[feature request] add the previous version in the output. #825

vdegenne opened this issue Dec 15, 2024 · 3 comments

Comments

@vdegenne
Copy link

vdegenne commented Dec 15, 2024

I like to run sudo n latest every now and then to make sure I'm always on the last version of NodeJS. The problem with n is that it's not always apparent whether node got updated or not. And if it does it doesn't necessarily show what upgrade it got.
In the output it would be nice to also show the previous version, e.g.

  installing : node-v23.4.0
       mkdir : /usr/local/n/versions/node/23.4.0
       fetch : https://nodejs.org/dist/v23.4.0/node-v23.4.0-linux-x64.tar.xz
     copying : node/23.4.0
   installed : v23.4.0 (with npm 10.9.2)
   previous  : v23.3.0
@shadowspawn
Copy link
Collaborator

shadowspawn commented Dec 16, 2024

The problem with n is that it's not always apparent whether node got updated or not.

I am not sure what this means. But I understand n does not tell you if you are reinstalling the active version of node.

I'll clarify what you see when you install. When the target version is not already in the cache, like when a new version comes out, it is downloaded into the cache and installed (copied) into /usr/local (or N_PREFIX).

$ n latest
  installing : node-v23.4.0
       mkdir : /usr/local/n/versions/node/23.4.0
       fetch : https://nodejs.org/dist/v23.4.0/node-v23.4.0-darwin-arm64.tar.xz
     copying : node/23.4.0
   installed : v23.4.0 (with npm 10.9.2)

When the target version is already in the cache, it is copied into /usr/local (or N_PREFIX). No download required.

$ n ls
node/18.20.4
node/20.18.0
node/22.12.0
node/23.4.0
$ n latest
     copying : node/23.4.0
   installed : v23.4.0 (with npm 10.9.2)

We can also see/do the download and install separately for a new version:

$ n rm latest      
latest (23.4.0) not in downloads cache
$ n download latest
    download : node-v23.4.0
       mkdir : /usr/local/n/versions/node/23.4.0
       fetch : https://nodejs.org/dist/v23.4.0/node-v23.4.0-darwin-arm64.tar.xz
$ n install latest
     copying : node/23.4.0
   installed : v23.4.0 (with npm 10.9.2)

@vdegenne
Copy link
Author

Thanks for the details.
I just meant to add the previous version it got updated from, for instance if I am on node v22.0.0 and use n latest it should show v22.0.0 somewhere before telling it got updated to v23.0.0 or something.

That's really just like adding node --version before anything got updated.

@vdegenne
Copy link
Author

surprisingly even nvm haven't thought of adding this trivial information (trivial as in a versioning manager)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants