Last active
September 24, 2018 20:17
-
-
Save allenhwkim/04f6285e9855b51572d863c698782f34 to your computer and use it in GitHub Desktop.
usage of .nvmrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To use this, add .nvmrc with contents of 'N.N.N' to your project. e.g. 0.12.7 | |
# Add the following to the end of .bash_profile or .bashrc | |
# | |
# if directory is changed | |
# if `.nvmrc` is found execute `nvm use` | |
# if `package.json` is round execute `nvm use default` | |
enter_directory() { | |
if [ "$PWD" != "$PREV_PWD" ]; then | |
PREV_PWD="$PWD"; | |
if [ -e ".nvmrc" ]; then | |
nvm use; | |
elif [ -e "package.json" ]; then | |
nvm use default | |
fi | |
fi | |
} | |
export PROMPT_COMMAND="$PROMP_COMMAND enter_directory;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment