intermediate

Turborepo

Use Turborepo task pipelines, hashing, remote cache, and dependency-aware execution for JavaScript monorepos.

Turborepo orchestrates package scripts through a `turbo.json` pipeline: tasks declare `dependsOn`, `outputs`, and `inputs` so work runs in topological order with local and remote caching.

					{
  "pipeline": {
    "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] },
    "test": { "dependsOn": ["build"], "outputs": [] }
  }
}
				

`^build` means upstream package builds run first. Cache hits require deterministic tasks and complete input hashing—including lockfiles and relevant env vars.

On interviews: pipeline dependencies, remote cache security, `--filter`, env in hash keys, and difference from package manager workspaces alone.

Common pitfalls: caching tests with flaky timing; missing `outputs` causing false cache hits; secrets in env hashed into shared cache.

The trade-off is CI time savings versus configuration rigor for cache correctness.

Checklist:

  • Declare outputs for cacheable tasks.
  • Hash env vars that affect builds.
  • Keep tasks deterministic.
  • Validate cache miss/hit behavior in CI.