Skip to content

Instantly share code, notes, and snippets.

@SamJakob
Created April 5, 2022 05:54
Show Gist options
  • Save SamJakob/f330484630818e8b2190bd9415575294 to your computer and use it in GitHub Desktop.
Save SamJakob/f330484630818e8b2190bd9415575294 to your computer and use it in GitHub Desktop.
zsh script to check if in an npm directory when trying to run yarn
# ...
# Ensure yarn is not run in an npm directory.
yarn() {
if [ -f "./package-lock.json" ]; then
echo "no... this is an npm directory"
else
command yarn $@
fi
}
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment