tweak: Initial commit
This commit is contained in:
commit
0c7dbf72a4
20
README.md
Normal file
20
README.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
NUÑO's STUPID NODE VERSION MANAGER
|
||||||
|
==================================
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The solution: Write a stupidly simple node version manager which is significantly simpler, hackier, less featureful, and less secure, but much faster.
|
||||||
|
|
||||||
|
Use this software at your own risk. In particular, consider reading the source code.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
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.
|
21
nsnvm.sh
Executable file
21
nsnvm.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dir="$HOME/.nnvm"
|
||||||
|
version="$1"
|
||||||
|
referent="node-v$version-linux-x64"
|
||||||
|
nodejs_url="https://nodejs.org/dist/v$version/$referent.tar.xz"
|
||||||
|
|
||||||
|
mkdir -p "$dir"
|
||||||
|
cd "$dir"
|
||||||
|
rm -f "$dir/$referent.tar.xz"
|
||||||
|
rm -rf "$dir/$referent"
|
||||||
|
wget "$nodejs_url"
|
||||||
|
tar xf "$referent.tar.xz"
|
||||||
|
|
||||||
|
sudo rm -f /usr/bin/node
|
||||||
|
sudo rm -f /usr/bin/npm
|
||||||
|
sudo rm -f /usr/bin/npx
|
||||||
|
|
||||||
|
sudo ln -s "$dir/$referent/bin/node" "/usr/bin"
|
||||||
|
sudo ln -s "$dir/$referent/bin/npm" "/usr/bin"
|
||||||
|
sudo ln -s "$dir/$referent/bin/npx" "/usr/bin"
|
Loading…
Reference in New Issue
Block a user