Skip to content

Commit

Permalink
feat(node): auto switch node version
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed May 5, 2024
1 parent 4e459c0 commit cc5c828
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-beans-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"web-ide": patch
---

feat(node): auto switch node version
10 changes: 7 additions & 3 deletions src/installers/node.installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ curl -L https://github.com/Schniz/fnm/releases/latest/download/fnm-$ARCH.zip -o
unzip /usr/local/bin/fnm-$ARCH.zip -d /usr/local/bin
rm -rf /usr/local/bin/fnm-$ARCH.zip
chmod +x /usr/local/bin/fnm
eval "`fnm env --shell zsh`"
eval "$(fnm env --shell=zsh)"

fnm use 18 --install-if-missing
fnm install 16
fnm install 18
fnm install 20
fnm install 22
fnm use 18
corepack enable
corepack install -g pnpm
corepack install -g yarn
Expand All @@ -36,7 +40,7 @@ echo "installing npm-check-updates"
npm i -g npm-check-updates

echo '# node
eval "`fnm env --shell zsh`" # for fnm
eval "$(fnm env --shell=zsh --use-on-cd --version-file-strategy=recursive)" # for fnm
alias cnpx="npx --registry=https://registry.npmmirror.com"
alias cnpm="npm --registry=https://registry.npmmirror.com"
alias cpnpm="pnpm --registry=https://registry.npmmirror.com"
Expand Down

0 comments on commit cc5c828

Please sign in to comment.