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

yarn workspaces

Show information about your workspaces.

What is a workspace?

To learn more about workspaces, check these links:

Commands

yarn workspaces info [--json]

This command will display the workspace dependency tree of your current project.

yarn workspaces info
yarn workspaces vx.x.x
{ "create-subscription": {
    "location": "packages/create-subscription",
    "workspaceDependencies": [],
    "mismatchedWorkspaceDependencies": []
  },
  ...
  "react-noop-renderer": {
    "location": "packages/react-noop-renderer",
    "workspaceDependencies": [
      "react-reconciler"
    ],
    "mismatchedWorkspaceDependencies": []
  },
  "react-reconciler": {
    "location": "packages/react-reconciler",
    "workspaceDependencies": [],
    "mismatchedWorkspaceDependencies": []
  }, ... }
yarn workspaces run <command>

This will run the chosen Yarn command in each workspace.

yarn workspaces run test

This will invoke the test script for each workspace.

This will also pass forward flags and can be useful for CI processes.

yarn workspaces run test --ci