commit 07aead41d4507e9f0750cf56e061c729a9372fe6
parent 0c7dbf72a429ad137efdbfb7bbb3366d935103a4
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Thu, 17 Nov 2022 16:53:04 +0000
tweak: fix bug, improve readme
Diffstat:
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
@@ -1,20 +1,32 @@
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
+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:
```
./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/)
diff --git a/nsnvm.sh b/nsnvm.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-dir="$HOME/.nnvm"
+dir="$HOME/.nsnvm"
version="$1"
referent="node-v$version-linux-x64"
nodejs_url="https://nodejs.org/dist/v$version/$referent.tar.xz"