跳到主内容
版本:9.x

pnpm -r, --recursive

Aliases: m, multi, recursive, <command> -r

与以下命令一起使用时,在工作区的每个项目中运行命令:

  • install
  • list
  • outdated
  • publish
  • rebuild
  • remove
  • unlink
  • update
  • why

在工作区的每个项目中运行命令,不包括根项目,与以下命令一起使用时为 :

  • exec
  • run
  • test
  • add

If you want the root project be included even when running scripts, set the include-workspace-root setting to true.

用法示例:

pnpm -r publish

配置项

  • Default: false
  • Type: true, false, deep

Link locally available packages in workspaces of a monorepo into node_modules instead of re-downloading them from the registry. This emulates functionality similar to yarn workspaces.

当它设置为 deep 时,本地 package 也可以被子依赖项链接到。

Be advised that it is encouraged instead to use npmrc for this setting, to enforce the same behaviour in all environments. 此选项单独存在,以便您可以在必要时覆盖它。

--workspace-concurrency

  • Default: 4
  • Type: Number

设置同时运行的最大任务数。 For unlimited concurrency use Infinity.

You can set the workpace-concurrency as <= 0 and it will use amount of cores of the host as: max(1, (number of cores) - abs(workspace-concurrency))

--[no-]bail

  • Default: true
  • Type: Boolean

如果为 true,则在任务抛出错误时停止。

此配置不会影响退出码(exit code)。 Even if --no-bail is used, all tasks will finish but if any of the tasks fail, the command will exit with a non-zero code.

示例(在每个 package 中 run test,如果其中任意一个失败则继续):

pnpm -r --no-bail test

--[no-]sort

  • Default: true
  • Type: Boolean

When true, packages are sorted topologically (dependencies before dependents). Pass --no-sort to disable.

示例:

pnpm -r --no-sort test

--reverse

  • Default: false
  • Type: boolean

When true, the order of packages is reversed.

pnpm -r --reverse run clean

--filter &lt;package_selector>

Read more about filtering.