这是indexloc提供的服务,不要输入任何密码
Skip to content

Allow root task to have dependsOn: ["*"] #4145

@connorjs

Description

@connorjs

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

I would like to run some script after all packages have executed a given task.

For example, running coverage task in each package, and then running an additional task at the root that merges/aggregates all of that coverage. I can think of similar postXxx tasks for documentation, copying/moving/bundling files, etc.

Keywords: "all packages", "star dependsOn"

Describe the solution you'd like

Due to the nature of “all packages,” I would like a special dependsOn value ("*") that only root tasks can reference.

Example:

"//#coverage": {
  "dependsOn": ["*coverage"]
}

Note: I originally thought just *, but realized *<task_name> may make more sense.

Describe alternatives you've considered

Alternatives I considered

  1. Running a new turbo instance. For example, having the root package.json’s coverage:root run turbo run coverage and have a postcoverage:root execute the aggregation. Not ideal because we would have two turbo runs which limits parallelization I think.

  2. Creating an umbrella @scope/all-packages package that declares every other package as a dependency. I could then use this package to execute any aggregation logic. Not ideal at first glance because I now have two places to maintain workspace configuration/workspace list, which can lead to out-of-sync issues.

    This has similarity to explicitly declaring dependencies in dependsOn for the root task, but I think Turbo prefers we use package.json dependencies to model package dependencies, and dependsOn to manage task dependencies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions