I added `-gx` to the `set` commands for fish so that the variables can be picked up by later runs of fnm. There are cases where the setup current code already works however it doesn't when the `FNM_...` variables haven't been exported globally before.
What are your thoughts on parameterizing the install script for local install? I know this seems weird but it means that I don't have to rely on developers having any tools already installed except bash and some way to edit the files. Here is an actual example script setup I would use.
Here is an example local install script `installLocal.sh`
```bash
#!/usr/bin/env bash
DESIRED_NODE_VERSION=v$(cat package.json | grep -Ei "\"node\"" | grep -Eoi "[0-9]+\.[0-9]+\.[0-9]+")
export FNM_DIR="$(pwd)/.fnm"
if [ ! -d "$FNM_DIR" ]; then
curl 'https://raw.githubusercontent.com/Schniz/fnm/master/.ci/install.sh' | INSTALL_DIR=`pwd` bash
fi
set -e
NODE_DIR="$FNM_DIR/node-versions/$DESIRED_NODE_VERSION/installation/bin"
export PATH=$FNM_DIR:$NODE_DIR:$PATH
#TODO: support fish
eval `fnm env --multi`
if [ ! -f "$NODE_DIR/node" ]; then
fnm install $DESIRED_NODE_VERSION
fi
sumOfPackageJson() {
cat package.json | md5sum | cut -d' ' -f1
}
if [ ! -f ".packageRevision" ] || [ "$(cat .packageRevision)" != "$(sumOfPackageJson)" ]; then
sumOfPackageJson > .packageRevision
npm install
fi
```
then in script called `nodew`
```bash
#!/usr/bin/env bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
source ./installLocal.sh
node "$@"
```
and `npmw`
```bash
#!/usr/bin/env bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
source ./installLocal.sh
npm "$@"
```
and for completeness sake I usually go one step further and do an `appw`
```bash
#!/usr/bin/env bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
source ./installLocal.sh
node ./app/index.js "$@"
```
* Use variants instead of a boolean
* Add infrastructure for multishell and aliases: Aliases are required because I want to have a default node version on startup
* create alias command
* fmt
* Added aliases (Fixes#29) and opt-in multishell support (Fixes#19)
* Better docs
* update snapshot
* Some/Fail => Some/None
* add lint-staged
* use refmt and all of prettier are grouped
* System.readdir => Fs.readdir (now uses Lwt)
* use lstat for file_exists: check if symlink exists instead of actual linked file. also, initialize the Random seed on Env
* Remove fish set options that were added in trial and error
* Bootstrap script
* add bootstrap documentation
* remove ansi codes from provided version string
* add check func whether the specify version is already installed or not
* Revert "remove ansi codes from provided version string"
This reverts commit 9e5b27f942e8be94c1bffda13a254f46cbf3dece.
* apply code review(rename check function)
* run esy fmt
* move short path to the top of the switch case
* use Result.fold instead of switch case
* use Array.exists instead of List.exists