sh is not considered by nvm to be a shell that can support passing options to
to sourced scripts as they are sourced, so we cannot do . nvm.sh --install
.
nvm's default behaviour upon sourcing is to run nvm use
bash would work fine but it's not the default shell, and it feels janky to have to replace
sh with bash at the start of this yml file just to support it, it's also not yet worth the
effort to maintain our own containers and associated build pipeline and container registry
need to set NVM_DIR for sourcing nvm.sh to work should probably set (and create) NVM_DIR before installing nvm
installing nvm from the repo directory causes it to see our .nvmrc and upon sourcing nvm.sh
it's default behaviour is to do the equivalent of nvm use $VERSION
which will fail because
$VERSION must be installed before it can be used
installing nvm via install.sh causes it to read NODE_VERSION whilst installing and it will
then install that version. "pre-installing" nvm.sh and then sourcing it causes failue because
sourcing nvm.sh whilst in the same dir as .nvmrc
causes it nvm use
rather than nvm install
We should consider installing (and sourcing) nvm from a temp directory and then later calling nvm install from the repo directory
improvements:
- skip fetching and running nvm's install script. can we instead just set $NVM_DIR and then fetch and source/run nvm.sh ourselves (maybe with a checksum check after download for safety). (As a half way house we could fetch nvm from somewhere we control, but meh, thats alot of faff
- consider bundling nvm.sh inside the repo to save time fetching and remove chance for failures at build time caused by network / gh outages
Actual Goal
- To have the right version node+npm installed and for that verson to be determined by the repo contents
nvm is just a means to that end and should cause to change to much else to accomodate it!