Turborepo provides powerful filtering capabilities that allow you to execute tasks only on specific packages or subsets of packages within your monorepo.
The turbo run --filter command is incredibly versatile:
--filter=<package-name>: Runs tasks only for the specified package.--filter='<package-name>...': Runs tasks for the specified package and all packages that depend on it.--filter='...<package-name>': Runs tasks for the specified package and all packages it depends on.--filter='[HEAD^1]': Runs tasks only for packages that have changed since the last commit.--filter='[<commit-ish>...]': Runs tasks for packages changed between the current HEAD and a specific commit/branch.
These filtering options are invaluable for optimizing CI/CD workflows, enabling you to run tests or builds only on the parts of your monorepo that were actually affected by a change. This targeted execution reduces CI times and resource consumption. Combining advanced turbo.json configurations with intelligent filtering allows for highly efficient and scalable monorepo management, ensuring developers get fast feedback and builds are always optimized.