[New] nvm alias: store --lts and --lts=<name>
`nvm alias default --lts node` writes `--lts node` to the alias file, so it resolves to the latest installed LTS version, using each version's recorded LTS status; `--lts=<name>` limits it to one LTS line. The flags of the outermost alias apply when one alias points at another, an alias with a flag this version of nvm doesn't recognize resolves to nothing, rather than ignoring the flag, and `nvm uninstall` also removes aliases with flags that point at the uninstalled version. A new shell never downloads index.tab, so it explains a default alias that needs LTS status that isn't recorded yet.
This commit is contained in:
5 files changed
+253
-14
No files matched your search
@@ -28,12 +28,14 @@ make_fake_node v20.1.10 || die 'fake node v20.1.10 could not be made'
|
||||
nvm_make_alias one v20.1.1 || die 'could not alias one'
|
||||
nvm_make_alias ten v20.1.10 || die 'could not alias ten'
|
||||
printf 'v20.1.1 # a comment\n' > "$(nvm_alias_path)/commented" || die 'could not alias commented'
|
||||
nvm_make_alias flagged '--lts v20.1.1' || die 'could not alias flagged'
|
||||
|
||||
nvm deactivate >/dev/null 2>&1
|
||||
nvm uninstall v20.1.1 >/dev/null 2>&1 || die 'nvm uninstall v20.1.1 failed'
|
||||
! nvm_is_version_installed v20.1.1 || die 'v20.1.1 should be uninstalled'
|
||||
[ ! -e "$(nvm_alias_path)/one" ] || die 'the alias to v20.1.1 should be removed'
|
||||
[ ! -e "$(nvm_alias_path)/commented" ] || die 'the alias to v20.1.1 with a comment should be removed'
|
||||
[ ! -e "$(nvm_alias_path)/flagged" ] || die 'the alias to v20.1.1 with --lts should be removed'
|
||||
[ "_$(nvm_alias ten)" = '_v20.1.10' ] || die "the alias to v20.1.10 should be kept; got >$(nvm_alias ten 2>&1)<"
|
||||
|
||||
cleanup
|
||||
@@ -51,6 +51,8 @@ recorded () {
|
||||
|
||||
(NVM_OFFLINE=1 nvm_ensure_lts_status)
|
||||
[ $? = 3 ] || die 'nvm_ensure_lts_status should not download while offline'
|
||||
(NVM_INDEX_NO_FETCH=1 nvm_ensure_lts_status)
|
||||
[ $? = 3 ] || die 'nvm_ensure_lts_status should not download when told not to, like while a shell starts up'
|
||||
[ ! -f "${DOWNLOADS}" ] || die "nothing should have been downloaded while offline; got $(cat "${DOWNLOADS}")"
|
||||
|
||||
nvm_ensure_lts_status || die 'nvm_ensure_lts_status should download and record LTS status'
|
||||
|
||||
Reference in new issue
Block a user