Provide relationship fallbacks #9719
notaphplover
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Update relationships to fallback to other relationships when not defined in a package:
Example of a dependency relationship with a fallback:
When a
serve:dev
task is requested, if the package defines aserve:dev
npm script, it will be invoked once theserve:dev
dependendent tasks (["^build"]
) are executed. If not, if the package defines aserve
npm script, it will be invoked once theserve
dependendent 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
fallbackTo
task. Multiple relationships are not supposed to be supported.fallbackTo
is 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:dev
npm script, but some other packages might not be able to do so, just providing a persistent interruptibleserve
script. 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