Skip to content

Instantly share code, notes, and snippets.

@martinratinaud
Created November 13, 2018 12:52
Show Gist options
  • Save martinratinaud/d0e1ae0e4807667cbe9dd37eab912b04 to your computer and use it in GitHub Desktop.
Save martinratinaud/d0e1ae0e4807667cbe9dd37eab912b04 to your computer and use it in GitHub Desktop.
`npm install` or `yarn` depending on which lock file is present
node_i() {
[ -f package-lock.json ] && NPM_I=true;
[ -f yarn.lock ] && YARN=true;
if [[ $NPM_I = true && $YARN = true ]]; then
echo -ne "\033[0;31myou have a package-lock.json and a yarn.lock, you should pick up only one!\033[0m"
echo ""
else
if [ $NPM_I ]; then
npm i
fi
if [ $YARN ]; then
yarn
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment