README.md (1792B)
1 Nuño's Stupid Node Version Manager 2 ================================== 3 4 ## The problem 5 6 Current node version managers, such as [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://asdf-vm.com/) are too slow. In particular, they add half a second to a few seconds when loaded with bash. 7 8 You can test this by removing these lines from your `.bashrc`: 9 10 ``` 11 export NVM_DIR="$HOME/.nvm" 12 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 13 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 14 ``` 15 16 or just by noticing that [nvm.sh](https://github.com/nvm-sh/nvm/blob/master/nvm.sh) has 4k+ lines. 17 18 ## The solution 19 20 Write a stupidly simple node version manager which is significantly simpler, hackier, less featureful, and less secure, but much faster. 21 22 ## Usage 23 24 Use this software at your own risk. In particular, strongly consider reading the 34 lines of source code to understand what it does. 25 26 Read the `nsnvm.sh` file, then execute it like: 27 28 ``` 29 ./nsvnm.sh 18.12.1 30 ``` 31 32 Make sure that you pass it one argument and that it is a correct node version number: there is no error checking. You can check node versions [here](https://nodejs.org/dist/index.json) or [here](https://nodejs.org/en/download/releases/) 33 34 ## Downsides 35 36 This setup will wreck your existing global node package installations, i.e., packages installed with `npm -g package_name`. To fix this, install a package again and look into `$HOME/.nsnvm/.../npm` for the location of the package, and wrap it in a bash alias. 37 38 ## Contributions 39 40 Contributions are welcome as long as they keep with the overall theme of simplicity. In particular, some small amount of error checking—e.g., checking that the version exists or that arguments aren't empy—would be fine.