yarn flags & options

add

Add a package as a dependency.

yarn add react
yarn add express@4.18.2

remove

Remove a package from dependencies.

yarn remove lodash

--dev, -D

Add a package as a dev dependency.

yarn add --dev typescript
yarn add -D eslint prettier

--peer

Add a package as a peer dependency.

yarn add --peer react

--frozen-lockfile

Fail if the lockfile needs to be updated, useful in CI environments.

yarn install --frozen-lockfile

workspace

Run a command in a specific workspace within a monorepo.

yarn workspace @myorg/api add express
yarn workspace @myorg/web build
yarn workspaces foreach run test

dlx

Run a package without installing it globally, similar to npx.

yarn dlx create-react-app my-app
yarn dlx degit user/repo my-project

why

Explain why a package is installed and what depends on it.

yarn why webpack
yarn why react-dom