Dotfiles/site-modules/core/files/nushell/scripts/nvm.nu
Ade Attwood 42cbeed7de fix(nu): support windows nicely
The main thing we are doing is setting the `HOME` and `USER` env variables so
we can use comon variables over linux and windows.

There is also a windows wezterm issue `shell_integration.osc133` feature needs
to be disabled. This will stop the prompt adding a new line on every char typed
into the prompt.
2025-07-25 09:03:11 +01:00

13 lines
467 B
Text

export def --env 'nvm dir-hook' [dir: string] {
let file = $"($dir)/.nvmrc"
if ($file | path exists) and ($file | path type) == "file" {
let version = (open $file | lines | get 0 | str trim)
if (nvm list | find $version | is-empty) {
nvm install $version
nvm use $version
npm i -g typescript-language-server typescript emmet-ls cspell vscode-langservers-extracted yarn
} else {
nvm use $version | complete | ignore
}
}
}