tweak: fix bug, improve readme

This commit is contained in:
NunoSempere 2022-11-17 16:53:04 +00:00
parent 0c7dbf72a4
commit 07aead41d4
2 changed files with 18 additions and 6 deletions

View File

@ -1,20 +1,32 @@
NUÑO's STUPID NODE VERSION MANAGER NUÑO's STUPID NODE VERSION MANAGER
================================== ==================================
## About ## The problem
The problem: 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. 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.
The solution: Write a stupidly simple node version manager which is significantly simpler, hackier, less featureful, and less secure, but much faster. You can test this by removing these lines from your `.bashrc`:
Use this software at your own risk. In particular, consider reading the source code. ```
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
```
or just by noticing that [nvm.sh](https://github.com/nvm-sh/nvm/blob/master/nvm.sh) has 4k+ lines.
## The solution
Write a stupidly simple node version manager which is significantly simpler, hackier, less featureful, and less secure, but much faster.
## Usage ## Usage
Use this software at your own risk. In particular, strongly consider reading the 20 lines of source code to understand what it does.
Read the `nsnvm.sh` file, then execute it like: Read the `nsnvm.sh` file, then execute it like:
``` ```
./nsvnm.sh 18.12.1 ./nsvnm.sh 18.12.1
``` ```
Make sure that you pass it one argument and that it is a correct node version number: there is no error checking. 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/)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
dir="$HOME/.nnvm" dir="$HOME/.nsnvm"
version="$1" version="$1"
referent="node-v$version-linux-x64" referent="node-v$version-linux-x64"
nodejs_url="https://nodejs.org/dist/v$version/$referent.tar.xz" nodejs_url="https://nodejs.org/dist/v$version/$referent.tar.xz"