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

feat: sibling tasks #9504

Merged
merged 4 commits into from
Nov 25, 2024
Merged

feat: sibling tasks #9504

merged 4 commits into from
Nov 25, 2024

Conversation

chris-olszewski
Copy link
Member

Description

This PR does 2 things:

  • Adds a 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.
  • Switches MFE proxy injection over to use 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 like turbo dev --filter=docs as just adding web to the filter will mean web#dev gets picked up which isn't what we desire. As you can see in run/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.

Copy link

vercel bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 4:29pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 4:29pm

@chris-olszewski chris-olszewski marked this pull request as ready for review November 22, 2024 22:42
@chris-olszewski chris-olszewski requested a review from a team as a code owner November 22, 2024 22:42
Copy link
Contributor

@NicholasLYang NicholasLYang left a 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

crates/turborepo-lib/src/micro_frontends.rs Outdated Show resolved Hide resolved

/// Adds a sibling relationship from task to sibling
pub fn with_sibling(&mut self, task: TaskName<'static>, sibling: &TaskName) {
if self.extends.is_empty() {
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this moment, yes.

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants