Skip to content

Commit

Permalink
docs(core): document wildcard support for dependsOn field (#27029)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
This feature is not yet documented...

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Document wildcard support in `dependsOn` field for project
configurations.

Note: Reading through the PR below that impls. this wildcard support, I
couldn't quite figure out if it was actually able to also work in case
of object syntax and whether this will also work for `targetDefaults`...
so if you know any better, please lemme know so I can update this PR 🙏

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

documents #19611
  • Loading branch information
elevenpassin authored Jul 29, 2024
1 parent ee2c41b commit acd9bb7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/shared/reference/project-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,27 @@ You can also express task dependencies with an object syntax:
{% /tab %}
{% /tabs %}

Starting from v19.5.0, wildcards can be used to define dependencies in the `dependsOn` field.

```json
{
"targets": {
"test": {
"dependsOn": [
{
"target": "build", // target name
"params": "ignore" // "forward" or "ignore", defaults to "ignore"
},
"build-*", // support for using wildcards in dependsOn, matches: "build-css", "build-js" targets of current project
"^build-*", // matches tasks: "build-css", "build-js" targets of dependencies
"*build-*", // matches tasks: "build-css", "build-js" as well as "task-with-build-in-middle" targets of current project
"^*build-*" // matches tasks: "build-css", "build-js" as well as "task-with-build-in-middle" targets of dependencies
]
}
}
}
```

#### Examples

You can write the shorthand configuration above in the object syntax like this:
Expand Down

0 comments on commit acd9bb7

Please sign in to comment.