nvmrc-check
v1.0.2
Published
Check if nvmrc version matches node version.
Downloads
670
Readme
nvmrc-check
- Add .nvmrc file to project root with version number:
8.0
- Add to package.json as script
scripts {
"postinstall": "nvmrc-check --node $(cat .nvmrc)"
}
- If current node version doesn't match, script fails.
Note: Use nvm trick with zsh to call nvm use
automatically whenever you enter a directory that contains an .nvmrc
file. Or add to your .bash_profile
(adapted from unix stackexchange thread):
cd () { builtin cd "$@" && chpwd; }
pushd () { builtin pushd "$@" && chpwd; }
popd () { builtin popd "$@" && chpwd; }
chpwd () {
FILE=$PWD/.nvmrc
if [ -f $FILE ];
then
nvm install $(cat .nvmrc)
fi
}