重要通知: 此文档针对的是 Yarn 1 (Classic) 版本。
对于 Yarn 2+ 文档及迁移指南,请访问 yarnpkg.cn。

yarn workspace

To learn more about workspaces, check these links:

yarn workspace <workspace_name> <command>

This will run the chosen Yarn command in the selected workspace.

Example:

yarn workspace awesome-package add react react-dom --dev

This will add react and react-dom as devDependencies in your packages/awesome-package/package.json.

If you want to remove a package:

yarn workspace web-project remove some-package

The example above would remove some-package from packages/web-project/package.json.