`fnm upgrade` command
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).
I actually would like it to upgrade the major version and then for minor or patches we could have flags.
@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.
Isn't fnm install already behave as you want?
fnm install 14 will install latest 14.x.x (14.20.0 at this time).
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.
Requirements:
-
fnm upgradeshould upgrade to latest patch version and optionally to latest minor version using something likefnm upgrade --minor - 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
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 versionOld 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-fromoption in fnm stackoverflow.com/a/34810922/2073920In nvm, we can do
nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSIONOther 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.