-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: sibling tasks #9504
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
feat: sibling tasks #9504
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question around extends
|
||
/// Adds a sibling relationship from task to sibling | ||
pub fn with_sibling(&mut self, task: TaskName<'static>, sibling: &TaskName) { | ||
if self.extends.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this? Do we only add siblings to workspace configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this moment, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we document this then?
Co-authored-by: Nicholas Yang <nicholas.yang@vercel.com>
### Description Make public the feature added in #9504 that allows for pulling in extra tasks into the graph without a `dependsOn` relationship. Renamed to `with` as it is better than `sibling` since that indicates a shared parent, which isn't required. ### Testing Instructions Added quick unit test for parsing and error validation. Basic test: ``` [0 olszewski@macbookpro] /tmp/with-test $ git diff diff --git a/turbo.json b/turbo.json index d6a7fe0..35fa9cd 100644 --- a/turbo.json +++ b/turbo.json @@ -15,7 +15,8 @@ }, "dev": { "cache": false, - "persistent": true + "persistent": true, + "with": ["build"] } } } # Verify web#build is in the graph [0 olszewski@macbookpro] /tmp/with-test $ turbo_dev --skip-infer web#dev --graph turbo 2.4.5-canary.4 digraph { compound = "true" newrank = "true" subgraph "root" { "[root] @repo/eslint-config#build" -> "[root] ___ROOT___" "[root] @repo/typescript-config#build" -> "[root] ___ROOT___" "[root] @repo/ui#build" -> "[root] @repo/eslint-config#build" "[root] @repo/ui#build" -> "[root] @repo/typescript-config#build" "[root] web#build" -> "[root] @repo/eslint-config#build" "[root] web#build" -> "[root] @repo/typescript-config#build" "[root] web#build" -> "[root] @repo/ui#build" "[root] web#dev" -> "[root] ___ROOT___" } } ``` Error message for trying to use `^` ``` [0 olszewski@macbookpro] /tmp/with-test $ turbo_dev --skip-infer web#dev turbo 2.4.5-canary.4 × Invalid turbo.json configuration ╰─▶ × `with` cannot use topological dependencies. ╭─[turbo.json:19:16] 18 │ "persistent": true, 19 │ "with": ["^build"] · ────┬─── · ╰── Remove `^` from start of task name. 20 │ } ╰──── ``` --------- Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
Description
This PR does 2 things:
sibling
attribute for task definitions that has the ability to bring another task into the graph without depending on it. This is currently only an attribute that can be set by us inside Rust, but I hope this use case proves useful enough to eventually make this a public API.siblings
where each dev task gets a"siblings": ["mfe-pkg#proxy"]
to ensure the proxy gets run.A sibling relationship acts similar to
dependsOn
except that it will not wait for the task to exit before starting and the sibling's task hash will not affect the current task's hash.Currently it's very hard to get
web#proxy
to run if the user runs a command liketurbo dev --filter=docs
as just addingweb
to the filter will meanweb#dev
gets picked up which isn't what we desire. As you can see inrun/builder.rs
this also removes the need of microfrontend knowledge from building the task graph.Testing Instructions
Added unit tests for sibling behavior as well as unit tests for MFE task injection.
Manual testing for the MFE behavior to make sure proxy still gets picked up.