Skip to main content

Yarn

Commands

Run package.json script from a different path

yarn --cwd <path> <command>

Yarn 2

yarn up
yarn add
yarn remove
yarn plugin list

Plugins

yarn plugin import <name>
yarn plugin remove @yarnpkg/<name>
yarn upgrade-interactive
yarn workspaces foreach run build

Workspaces

Add dependency to root repo

yarn add <package> [--dev] -W

Flag -W is not supported in Yarn 2, simply add dependency in monorepo root directory.

Add dependency to specific workspace

yarn workspace <workspace> add <package> [--dev]