pnpm -r, --recursive

Псевдоніми: m, multi, recursive, <command> -r

Запускає команду у кожному проєкті робочої області, коли використовується з наступними командами:

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

Запускає команду у кожному проєкті робочої області, за винятком кореневого проєкту, при використанні з наступними командами:

  • exec
  • run
  • test
  • add

Якщо ви хочете, щоб кореневий проєкт було включено навіть під час виконання скриптів, встановіть для параметра includeWorkspaceRoot значення true.

Приклад використання:

pnpm -r publish

By default, recursive run, exec, and test execute projects in topological order: dependencies run before their dependents. Use --no-sort to disable graph ordering, or --parallel to start tasks without waiting for dependencies.

Параметри#

  • Стандартно: false
  • Тип: true, false, deep

Звʼязує локально доступні пакунки у робочих просторах монорепо в node_modules замість того, щоб повторно завантажувати їх з реєстру. Це емуляція функціоналу, подібного до yarn workspaces.

Якщо встановлено значення deep, локальні пакунки також можуть бути звʼязані з підзалежностями.

Зауважте, що замість цього рекомендується використовувати pnpm-workspace.yaml для цього параметра, щоб забезпечити однакову поведінку у всіх середовищах. Цей параметр існує виключно для того, щоб ви могли його замінити, якщо це необхідно.

--workspace-concurrency#

  • Default: the smaller of 4 and the number of available CPU cores
  • Тип: Number

Встановлює максимальну кількість завдань, що виконуються одночасно. Для необмеженого паралелізму використовуйте Infinity.

In a container with a CPU quota, such as a Kubernetes CPU limit, the quota is the number of available CPU cores when it is smaller than the number of CPUs the container may run on. A fractional quota is rounded down, to at least 1.

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

--[no-]bail#

  • Стандартно: true
  • Тип: Boolean

Якщо значення true, зупиняється, коли завдання видає помилку.

With --no-bail, tasks that depend on a failed task are skipped and independent tasks keep running. This config does not affect the exit code: if any task fails, the command exits with a non-zero code. See --no-bail.

Приклад (запустити тести у кожному пакунку, продовжити, якщо тести не спрацювали в одному з них):

pnpm -r --no-bail test

--[no-]sort#

  • Стандартно: true
  • Тип: Boolean

When true, commands follow the workspace dependency graph. Recursive run also applies relationships from the tasks setting. Pass --no-sort to remove graph ordering. This also makes tasks, --reverse, and --resume-from inapplicable.

Приклад:

pnpm -r --no-sort test

--reverse#

  • Стандартно: false
  • Тип: Boolean

When true, dependency edges are reversed. For recursive run, this reverses the resolved task graph, including relationships declared with dependsOn.

pnpm -r --reverse run clean

--filter <package_selector>#

Читайте більше про фільтрування.