Understanding your repository
Turborepo includes tools for understanding your repository structure, that can help you use and optimize your codebase.
turbo ls
To list your packages, you can run turbo ls
. This will show the packages in your repository and where they're located.
You can apply filters to ls
, just like run
:
turbo run
To determine which tasks can be run in your monorepo, simply call turbo run
without any tasks. You will get a list of
tasks and the packages in which they are defined:
turbo query
If you wish to dig into your repository structure, since 2.2.0
, Turbo provides a GraphQL interface into your repository
via turbo query
. You can execute queries such as finding all packages that have a test
task:
This can be helpful for diagnosing potential problems in your package or task dependency graph. For instance, let's say you're getting a lot of cache misses in your builds. This could be because there's a package that keeps getting changed and is imported throughout your codebase.
To do this, we can run a query to find packages that are directly imported more than 10 times in your monorepo:
Now that we've found this package, we can try to split it up into smaller packages so that a small change won't invalidate the whole dependency graph.
Or let's say you're using our new --affected
flag, but you're still running more tasks than you'd like.
With turbo query
, you can find all the packages and the reason why they were invalidated:
Was this helpful?