Common Filter Patterns
Practical examples for typical monorepo scenarios.
Single Package
Run task in one package:
turbo run build --filter=web
turbo run test --filter=@acme/apiPackage with Dependencies
Build a package and everything it depends on:
turbo run build --filter=web...Useful for: ensuring all dependencies are built before the target.
Package Dependents
Run in all packages that depend on a library:
turbo run test --filter=...uiUseful for: testing consumers after changing a shared package.
Dependents Only (Exclude Target)
Test packages that depend on ui, but not ui itself:
turbo run test --filter=...^uiChanged Packages
Run only in packages with file changes since last commit:
turbo run lint --filter=[HEAD^1]Since a specific branch point:
turbo run lint --filter=[main...HEAD]Changed + Dependents (PR Builds)
Run in changed packages AND packages that depend on them:
turbo run build test --filter=...[HEAD^1]Or use the shortcut:
turbo run build test --affectedDirectory-Based
Run in all apps:
turbo run build --filter=./apps/*Run in specific directories:
turbo run build --filter=./apps/web --filter=./apps/apiScope-Based
Run in all packages under a scope:
turbo run build --filter=@acme/*Exclusions
Run in all apps except admin:
turbo run build --filter=./apps/* --filter=!adminRun everywhere except specific packages:
turbo run lint --filter=!legacy-app --filter=!deprecated-pkgComplex Combinations
Apps that changed, plus their dependents:
turbo run build --filter=...[HEAD^1] --filter=./apps/*All packages except docs, but only if changed:
turbo run build --filter=[main...HEAD] --filter=!docsDebugging Filters
Use --dry to see what would run without executing:
turbo run build --filter=web... --dryUse --dry=json for machine-readable output:
turbo run build --filter=...[HEAD^1] --dry=jsonCI/CD Patterns
PR validation (most common):
turbo run build test lint --affectedDeploy only changed apps:
turbo run deploy --filter=./apps/* --filter=[main...HEAD]Full rebuild of specific app and deps:
turbo run build --filter=production-app...