Extend inputs, don't replace

Start inputs with $TURBO_DEFAULT$ or source edits stop busting cache.

From turborepo, configuration/gotchas.md, “Overwriting Default Inputs”.

Edit a file, watch the hash

Edit a file; ui#test runs and checks its hash.

Replaced defaultsBad
last run –0 stale hits
"inputs": ["tests/**"]
Extended defaultsGood
last run –0 stale hits
"inputs": ["$TURBO_DEFAULT$", "!README.md"]
{
  "tasks": {
    "test": {
      "inputs": [
        "$TURBO_DEFAULT$",                   // every git-tracked file in the package
        "!README.md",                        // minus docs
        "$TURBO_ROOT$/tsconfig.base.json"    // a root file: never "../"
      ]
    }
  }
}

Why it matters, pros and cons

Why it matters

By default a task hashes every tracked file in its package. Any inputs list replaces that set unless it starts with $TURBO_DEFAULT$.

Pros

  • Docs-only edits stay cache hits.
  • Source edits still re-run the task.
  • $TURBO_ROOT$ reaches root files safely.

Cons

  • Too narrow a list gives silent stale hits.
  • Default inputs skip gitignored files like .env.
  • Debug a surprise with --summarize or --dry=json.