fnm icon indicating copy to clipboard operation
fnm copied to clipboard

`fnm upgrade` command

Open waldyrious opened this issue 3 years ago • 11 comments

It would be nice to have an fnm upgrade command that would upgrade the current Node version to the latest minor version, and optionally remove the old ole (e.g. with an extra CLI option, like --rm-old).

Alternatively, if upgrading minors is considered too dangerous to be the default, this command could upgrade just the patch version, and upgrading the minor version would be done by explicitly passing a separate CLI option (e.g. fnm upgrade --minor).

waldyrious avatar Jul 14 '22 11:07 waldyrious

I actually would like it to upgrade the major version and then for minor or patches we could have flags.

satvikpendem avatar Jul 25 '22 01:07 satvikpendem

@satvikpendem there's already fnm install --lts / fnm install lts-latest to install the latest LTS. Apparently there's no convenient shorthand to install the latest non-LTS version (cc @dennisbaum), but that functionality should IMO come in the form of an fnm install latest and/or fnm install --latest, rather than as part of an upgrade subcommand.

waldyrious avatar Jul 25 '22 08:07 waldyrious

Isn't fnm install already behave as you want? fnm install 14 will install latest 14.x.x (14.20.0 at this time).

alexeyten avatar Jul 26 '22 07:07 alexeyten

Yeah, but if I'm on 14 I'd like fnm upgrade to bump me to the latest 14.x.x, whereas if I'm on 16 I'd like the same command to bump me to the latest 16.x.x. Of course it's possible to do that in other ways, it's just a convenience shortcut that I feel fnm could offer easily, building upon its existing functionality.

waldyrious avatar Jul 26 '22 09:07 waldyrious

Requirements:

  1. fnm upgrade should upgrade to latest patch version and optionally to latest minor version using something like fnm upgrade --minor
  2. it should migrate global packages from old version to new version

Old version can be manually removed later after verification and testing. Doing this in upgrade command is risky. Currently for step 2 I am using this approach https://github.com/Schniz/fnm/issues/481#issuecomment-1292726042

Ideally, we need something like --reinstall-packages-from option in fnm https://stackoverflow.com/a/34810922/2073920

In nvm, we can do nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION Other step 2 related issues: https://github.com/Schniz/fnm/issues/481 https://github.com/Schniz/fnm/issues/620

armujahid avatar May 05 '23 06:05 armujahid

Requirements:

1. `fnm upgrade` should upgrade to latest patch version and optionally to latest minor version using something like `fnm upgrade --minor`

2. it should migrate global packages from old version to new version

Old version can be manually removed later after verification and testing. Doing this in upgrade command is risky. Currently for step 2 I am using this approach #481 (comment)

Ideally, we need something like --reinstall-packages-from option in fnm stackoverflow.com/a/34810922/2073920

In nvm, we can do nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION Other step 2 related issues: #481 #620

I have submitted pull requests before.

https://github.com/Schniz/fnm/pull/510

Need a Shell-less implementation, such as using rust to call npm directly.

libook avatar Nov 09 '23 02:11 libook