Yarn is the new fancy NPM client by Facebook. Compared to the good ol' npm command line client, Yarn is faster and provides by default what you can achieve with
npm shrinkwrap. It's even got fancier output. Emojis apart, its output is more succinct than npm's, which spits out a lot of things I don't really want to know about.
After switching to Yarn I found out how much I rely on muscular memory when typing on my keyboard. I found myself typing by mistake
npm install when I should've typed
yarn add When this happens, the
yarn.lock file stops reflecting what is installed in the
My solution to this problem was to alias
npm like below. This alias will check if
yarn.lock exists, stop me and even tell me off.
npm='test -e yarn.lock && >&2 echo "yarn.lock found in current directory. Use yarn instead." || npm'