Provide relationship fallbacks #9719
notaphplover
started this conversation in
Ideas
Replies: 1 comment
-
|
I would love this as well. My use case involves a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Update relationships to fallback to other relationships when not defined in a package:
Example of a dependency relationship with a fallback:
{ "tasks": { "serve:dev": { "dependsOn": ["^build"], "fallbackTo": "serve" }, "serve": { "dependsOn": ["build"], } } }When a
serve:devtask is requested, if the package defines aserve:devnpm script, it will be invoked once theserve:devdependendent tasks (["^build"]) are executed. If not, if the package defines aservenpm script, it will be invoked once theservedependendent tasks (["build"]) are executed. If not, turbo should behave as if the task was not found in the package.Non-goals
A single relationship must be established as a
fallbackTotask. Multiple relationships are not supposed to be supported.fallbackTois just a name proposal. I don't mind using any other name or approach as long as it supports the requested feature.Background
Sometimes I miss this feature. Let's say we want to implement the "serve:dev" task relying on the awesome watch feature. Some packages might be able to provide a persistent non interruptible
serve:devnpm script, but some other packages might not be able to do so, just providing a persistent interruptibleservescript. The requested feature could be used to achieve this use case and many more.Proposal
Tbh the feature seems pretty straightforward, but I'm not familiar with the turbo source code. The only edge case that comes to my mind is circular dependencies, but current turbo configs already allow the user to define circularly dependent task, so it shouldn't be super painful to update the source code.
If you give me the chance, I would love to submit a PR, specially if you provide some hints like the relevant source file where the task is executed 😃
Beta Was this translation helpful? Give feedback.
All reactions