Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: dependsOn is easy to use incorrectly and have tasks run out of order #8066

Open
alex-page opened this issue May 1, 2024 · 2 comments
Labels
area: docs Improvements or additions to documentation owned-by: turborepo

Comments

@alex-page
Copy link

What is the improvement or update you wish to see?

It would be great to add an example for when to use ^build, build and the tradeoffs of this approach. This is a pattern we have noticed across many repositories turbo.json files.

Is there any context that might help us understand?

My current project set up:

On a project I am working on we recently started using "test": { "dependsOn": ["^build"]}. It wasn't clear why the scripts were running out of order.

We noticed pnpm build would be running at the same time as pnpm test and some workspaces were waiting for other workspaces to complete building correctly but packages that depended on themselves to complete build did not wait and would run test at the same time.

Later we realised if added ^build, build it would run in order.

turbo.json

- "test": { "dependsOn": ["^build"]},
+ "test": { "dependsOn": ["^build", "build"]},

Does the docs page already exist? Please link to it.

https://turbo.build/repo/docs/reference/configuration#dependson

@anthonyshew
Copy link
Contributor

I might be misunderstanding but the doc you've linked fairly succinctly describes your use case. Can you explain why it's confusing?

There's also a longer explanation with examples here: https://turbo.build/repo/docs/core-concepts/monorepos/task-dependencies#from-the-same-workspace

@alex-page
Copy link
Author

alex-page commented May 1, 2024

We found the task dependency documentation but it would have been nice to have a reference to those details from the dependsOn configuration page. Searching dependsOn takes you to the configuration page.

The dependsOn example on the configuration page doesn't have any examples with both "^build", "build" and explain why this pattern would be helpful.

@anthonyshew anthonyshew added area: docs Improvements or additions to documentation owned-by: turborepo labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation owned-by: turborepo
Projects
None yet
Development

No branches or pull requests

2 participants