Getting familiar with the yarn CLI

yarn has most of the functionality for the npm CLI. The following table compares the corresponding commands:

 

Apart from the basics, yarn also has some non-essential, but otherwise neat, features that'll help you in your workflow:

  • yarn licenses ls: Prints out, on the console, a list of packages, their URLs and their licenses
  • yarn licenses generate-disclaimer: Generates a text file containing the licenses of all the dependencies
  • yarn why: Generates a dependency graph to figure out why a package was downloaded—for example, it might be a dependency of a dependency of our application
  • yarn upgrade-interactive: Provides an interactive wizard that allows you to selectively upgrade outdated packages

You can get a full list of CLI commands at https://yarnpkg.com/en/docs/cli/, or by running yarn help on your Terminal.