How to configure Turbo dependencies to only consider task inputs? #9965
Unanswered
shawmanz32na
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
My specific situation is that, in my monorepo project, I have a project (server-push) that uses tsoa to generate an OpenAPI Spec from the implementation code, and then uses that generated OpenAPI spec to generate clients using openapi-generator. Then, we have other projects in the monorepo that depend on the generated clients. I've attempted to configure Turbo so that clients are only regenerated if there are changes to the OpenAPI Spec, but I'm seeing that whenever the project gets built, the clients are (re)generated, even when the OpenAPI Spec hasn't changed.
Summarizing the dependencies,
server-push#build
must have been run (to generate the OpenAPI Spec) beforeserver-push#generate
can run, andserver-push#generate
must have been run (to generate the clients) before any of the projects' build goals that use the generated clients can run (because they use the generated clients). But, The clients only need to get regenerated if the OpenAPI Spec changes, regardless of whetherserver-push#build
was run (since it's perfectly valid to make a bug fix or something in that project that doesn't change the API).Again, what I'm seeing is that
server-push#generate
will run (not use the cache) any timeserver-push#build
has been run, even if there were no changes to the inputs configured forserver-push#generate
(and then this leads to all the projects that depend on the generated clients to get built, too, which is a huge time suck).Here's the relevant part of the server-push project's package.json:
And here's the relevant part of the monorepo's turbo.json:
And, here's a snippets of the

--summarize
output for two subsequent runs ofturbo run build:war
in which I added a comment in one of the source files in server push, which should rightly trigger a rerun ofserver-push#build
, but does not change the generated OpenAPI Spec and should therefore not trigger a re-run ofserver-push#generate
, but, as you can see, the task hash changes even though the hashes of all inputs are identical:Am I doing something wrong? How can I configure Turbo to actually optimize the build operations correctly?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions