nvmrc-check

1.0.2 • Public • Published

nvmrc-check

  1. Add .nvmrc file to project root with version number:
8.0
  1. Add to package.json as script
scripts {
  "postinstall": "nvmrc-check --node $(cat .nvmrc)"
}
  1. 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
}

Readme

Keywords

Package Sidebar

Install

npm i nvmrc-check

Weekly Downloads

134

Version

1.0.2

License

MIT

Last publish

Collaborators

  • skylerfenn