-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Which project is this feature idea for?
Turborepo
Describe the feature you'd like to request
Currently, the documentation shows that passthrough args are possible when calling many pipelines. However, this introduces a partitioning problem for the cache since all arguments are applied to all pipelines.
As an example, let's say I use turbo lint format
where lint
is an ESLint script and format
is a Prettier script.
If I want to run a "clean up all my code" command, I would probably write turbo lint format -- --write --fix
.
--fix
is responsible for tellingturbo lint
(ESLint under the hood) to fix any issues that it can and write them to disk--write
is responsible for tellingturbo format
(Prettier under the hood) to write formatting fixes to disk
This works at first glance but has a hidden downside: The formatting command effectively becomes turbo format -- --write --fix
, unnecessarily including the --fix
argument. The same is true for turbo lint -- --write --fix
(erroneous --write
).
If I were to then run turbo lint -- --fix
(the correct command), I will now have cache misses because the first command I called was partitioned using both arguments rather than the one I actually need.
This API interface blocks me from being able to do what I truly want: Run multiple pipelines with their own arguments in parallel with one turbo
command.
Note that lint
, format
, ESLint, and Prettier are arbitrary. ESLint throws errors on unknown args so eslint . --fix --write
would throw an error on the --write
arg. I'm only trying to demonstrate the problem for the API surface.
Describe the solution you'd like
I admittedly haven't thought of a truly elegant solution for this yet. I'm mostly drawing up this issue as a conversation starter. Only thing coming to mind for me thinking about it for a few minutes is something like:
turbo [lint -- --fix] [format -- --write] -- --foo
With this syntax, we would get:
--fix
and--foo
as args for thelint
pipeline--write
and--foo
as args for theformat
pipeline
Describe alternatives you've considered
Currently, my workaround is to run the commands serially. turbo lint -- --fix && turbo format -- --write
- which, of course, does not achieve the desired parallelism. But at least I can get everything done in one command!
I'll have a longer think about alternatives; I may be back! 😄