The turbo.json file is the heart of your Turborepo setup, controlling how tasks are executed. The pipeline object within turbo.json allows you to define configurations for each of your common scripts (e.g., build, test, lint).
Key properties include:
dependsOn: Specifies task dependencies.^buildmeans 'run thebuildtask on all dependencies of this package first.'buildmeans 'run thebuildtask on this package first.' This creates the task graph.outputs: An array of file paths or glob patterns that represent the cached output of a task. If these files are detected in the cache, the task won't re-run.inputs: An array of file paths or glob patterns that Turborepo should use when calculating the hash for a task. This allows you to include or exclude specific files that might affect a task's outcome.cache: A boolean to enable/disable caching for a specific task. Useful fordevscripts that are persistent.persistent: A boolean for tasks that should run continuously (e.g., a development server).dotEnv: An array of.envfile names to include in the task's hash. This ensures environment variable changes invalidate the cache.
Mastering these properties allows you to finely tune caching behavior and task execution logic, dramatically enhancing your monorepo's performance.