这是indexloc提供的服务,不要输入任何密码
Skip to content

Split passthrough args to specific pipelines #5743

@anthonyshew

Description

@anthonyshew

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 telling turbo lint (ESLint under the hood) to fix any issues that it can and write them to disk
  • --write is responsible for telling turbo 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 the lint pipeline
  • --write and --foo as args for the format 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! 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: triageNew issues get this label. Remove it after triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions