Skip to content

Instantly share code, notes, and snippets.

@dmcshehan
Created April 21, 2020 11:57
Show Gist options
  • Save dmcshehan/ce91ab1b0094eb4b5470fbd771aeb118 to your computer and use it in GitHub Desktop.
Save dmcshehan/ce91ab1b0094eb4b5470fbd771aeb118 to your computer and use it in GitHub Desktop.
Yarn Commands

Useful yarn commands all in one place

I recently watched yarn crash course by Traversy Media on YouTube and though of listing all the commands in that video. lodash and nodemon packages are taken as examples. Enjoy 😃

Description Command
Set config $ yarn config set init-license MIT
Get config $ yarn config get init-license
Delete config $ yarn config delete init-license
Install a package $ yarn add lodash
Remove installed package $ yarn remove loadash
Install a specific version of a package $ yarn add lodash@4.17.3
Upgrade an existing outdated package $ yarn upgrade lodash@4.17.5
Add a global package $ yarn global add nodemon
Check where yarn installs global stuff $ yarn global bin
Remove a global package $ yarn global remove nodemon
Get installed dependencies (dependencies of dependencies) $ yarn list
Get top most dependencies $ yarn list - -depth=0
Get dependencies for specific package $ yarn list —pattern gulp
Install a dev dependency $ yarn add gulp --dev
Remove a dev dependency $ yarn remove gulp
Check versions of the package.json with yarn.lock $ yarn check
Generate a yarn.lock file from package.json $ yarn import
Run scripts $ yarn run dev
Check licenses of packages $ yarn licenses list
Create .tgz file of packages $ yarn pack
Check cache $ yarn cache
Check cache for a specific package $ yarn cache list - -pattern lodash
Clear yarn cache $ yarn cache clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment