Skip to content

Commit 8b08888

Browse files
build(turbo): scope root-file inputs to the tasks that read them (#50)
## What changes - `globalDependencies` is gone. flake.nix, flake.lock, commitlint.config.ts, .lintstagedrc.js, tsconfig.node.json and scripts/** were global, so a flake bump re-ran every task of every package. Only `//#typecheck:node` and `//#test:scripts` read them, and both already list them as inputs. - `tsconfig.base.json` and `oxlint.shared.ts` are inputs of `apps/site` and `apps/site-e2e` only, through new package `turbo.json` files. Those two apps are the only importers (`turbo query 'query { boundaries { items { message path } } }'` reports their `../../oxlint.shared.ts` and `../../stryker.shared.ts` imports; their tsconfigs extend `../../tsconfig.base.json`). - Package tasks no longer depend on `//#typecheck:node`, `//#test:scripts`, `//#lint:suppressions` or `//#format:check`. These edges made every package's `lint` wait on the repo-wide format check and run whenever any root file changed. The root `lint` and `typecheck` scripts already name these root tasks. - `futureFlags.affectedUsingTaskInputs` matches changed files against each task's `inputs`. - Root tasks that had no `inputs` and that the apps extend now say `$TURBO_DEFAULT$` explicitly, so `$TURBO_EXTENDS$` in the app files keeps the default inputs. A CI job that runs `turbo run ... --affected` must name the root tasks it wants (`typecheck:node`, `lint:suppressions`, `test:scripts`), since package tasks no longer pull them in. ## Evidence turbo 2.11.7. Each probe appends one line to the file on top of the base commit, then runs `turbo query 'query { affectedTasks(base: "<base>", head: "HEAD", tasks: [...]) { length items { fullName reason { __typename } } } }'` with `typecheck lint attw`, then with `test`. Before is the default branch, after is this branch. | Changed file | typecheck/lint/attw before → after | test before → after | Reasons before | Reasons after | |---|---|---|---|---| | `AGENTS.md` | 17 → 0 | 0 → 0 | TaskAllChanged 9, TaskDependencyTaskChanged 6, TaskFileChanged 2 | none | | `flake.lock` | 36 → 0 | 12 → 0 | TaskGlobalDepsChanged 36 | none | | `commitlint.config.ts` | 36 → 0 | 12 → 0 | TaskGlobalDepsChanged 36 | none | | `tsconfig.base.json` | 36 → 10 | 12 → 3 | TaskGlobalDepsChanged 36 | TaskDependencyTaskChanged 2, TaskFileChanged 8 | | `oxlint.shared.ts` | 36 → 6 | 12 → 0 | TaskGlobalDepsChanged 36 | TaskAllChanged 3, TaskFileChanged 3 | | `apps/site/src/api/check-health.workflow.ts` | 21 → 6 | 3 → 2 | TaskAllChanged 8, TaskDependencyTaskChanged 6, TaskFileChanged 7 | TaskDependencyTaskChanged 1, TaskFileChanged 5 | | `packages/atom/effect-atom-react/README.md` | 21 → 0 | 5 → 0 | TaskAllChanged 13, TaskDependencyTaskChanged 6, TaskFileChanged 2 | none | The drops on an app source change are the root-task edges and the repo-wide format check that every lint used to wait on. Real ranges from this repository's history, replayed with this change applied to both ends: | Range | typecheck/lint/attw before → after | test before → after | Package reasons before | |---|---|---|---| | `b096c94e2d..4bbba74` | 36 → 11 | 12 → 5 | GlobalDepsChanged 7 | | `364db0c72e..1def24b` | 17 → 0 | 0 → 0 | FileChanged 1 | | `86b638988a..daaef80` | 30 → 23 | 9 → 8 | FileChanged 5 | --------- Co-authored-by: systemfsoftware-bot <318394648+systemfsoftware-bot@users.noreply.github.com>
1 parent 596177c commit 8b08888

4 files changed

Lines changed: 144 additions & 18 deletions

File tree

‎.changeset/weak-onions-fail.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@systemfsoftware/effect-atom": none
3+
"@systemfsoftware/effect-atom-react": none
4+
"@systemfsoftware/oxlint-config-frontend": none
5+
"@systemfsoftware/storybook-gherkin": none
6+
---
7+
8+
Internal task selection only: turbo matches changed files against task inputs and root files are no longer global dependencies; nothing a consumer installs changes.

‎apps/site-e2e/turbo.json‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"$schema": "https://turborepo.dev/schema.json",
3+
"extends": [
4+
"//"
5+
],
6+
"tasks": {
7+
"generate": {
8+
"inputs": [
9+
"$TURBO_EXTENDS$",
10+
"$TURBO_ROOT$/tsconfig.base.json"
11+
]
12+
},
13+
"build": {
14+
"inputs": [
15+
"$TURBO_EXTENDS$",
16+
"$TURBO_ROOT$/tsconfig.base.json"
17+
]
18+
},
19+
"typecheck": {
20+
"inputs": [
21+
"$TURBO_EXTENDS$",
22+
"$TURBO_ROOT$/tsconfig.base.json",
23+
"$TURBO_ROOT$/oxlint.shared.ts"
24+
]
25+
},
26+
"lint": {
27+
"inputs": [
28+
"$TURBO_EXTENDS$",
29+
"$TURBO_ROOT$/tsconfig.base.json",
30+
"$TURBO_ROOT$/oxlint.shared.ts"
31+
]
32+
},
33+
"lint:tsgo": {
34+
"inputs": [
35+
"$TURBO_EXTENDS$",
36+
"$TURBO_ROOT$/tsconfig.base.json",
37+
"$TURBO_ROOT$/oxlint.shared.ts"
38+
]
39+
},
40+
"test": {
41+
"inputs": [
42+
"$TURBO_EXTENDS$",
43+
"$TURBO_ROOT$/tsconfig.base.json"
44+
]
45+
},
46+
"test:types": {
47+
"inputs": [
48+
"$TURBO_EXTENDS$",
49+
"$TURBO_ROOT$/tsconfig.base.json"
50+
]
51+
},
52+
"test:browser": {
53+
"inputs": [
54+
"$TURBO_EXTENDS$",
55+
"$TURBO_ROOT$/tsconfig.base.json"
56+
]
57+
},
58+
"mutation": {
59+
"inputs": [
60+
"$TURBO_EXTENDS$",
61+
"$TURBO_ROOT$/tsconfig.base.json"
62+
]
63+
}
64+
}
65+
}

‎apps/site/turbo.json‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"$schema": "https://turborepo.dev/schema.json",
3+
"extends": [
4+
"//"
5+
],
6+
"tasks": {
7+
"generate": {
8+
"inputs": [
9+
"$TURBO_EXTENDS$",
10+
"$TURBO_ROOT$/tsconfig.base.json"
11+
]
12+
},
13+
"build": {
14+
"inputs": [
15+
"$TURBO_EXTENDS$",
16+
"$TURBO_ROOT$/tsconfig.base.json"
17+
]
18+
},
19+
"typecheck": {
20+
"inputs": [
21+
"$TURBO_EXTENDS$",
22+
"$TURBO_ROOT$/tsconfig.base.json"
23+
]
24+
},
25+
"lint": {
26+
"inputs": [
27+
"$TURBO_EXTENDS$",
28+
"$TURBO_ROOT$/tsconfig.base.json",
29+
"$TURBO_ROOT$/oxlint.shared.ts"
30+
]
31+
},
32+
"lint:tsgo": {
33+
"inputs": [
34+
"$TURBO_EXTENDS$",
35+
"$TURBO_ROOT$/tsconfig.base.json"
36+
]
37+
},
38+
"test": {
39+
"inputs": [
40+
"$TURBO_EXTENDS$",
41+
"$TURBO_ROOT$/tsconfig.base.json"
42+
]
43+
},
44+
"test:types": {
45+
"inputs": [
46+
"$TURBO_EXTENDS$",
47+
"$TURBO_ROOT$/tsconfig.base.json"
48+
]
49+
},
50+
"test:browser": {
51+
"inputs": [
52+
"$TURBO_EXTENDS$",
53+
"$TURBO_ROOT$/tsconfig.base.json"
54+
]
55+
},
56+
"mutation": {
57+
"inputs": [
58+
"$TURBO_EXTENDS$",
59+
"$TURBO_ROOT$/tsconfig.base.json"
60+
]
61+
}
62+
}
63+
}

‎turbo.json‎

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
{
22
"$schema": "https://v2-11-7.turborepo.dev/schema.json",
3+
"futureFlags": {
4+
"affectedUsingTaskInputs": true
5+
},
36
"agentGuidance": false,
4-
"globalDependencies": [
5-
"oxlint.shared.ts",
6-
"stryker.shared.ts",
7-
"tsconfig.base.json",
8-
"tsconfig.node.json",
9-
"commitlint.config.ts",
10-
".lintstagedrc.js",
11-
"flake.nix",
12-
"flake.lock",
13-
"scripts/**"
14-
],
157
"globalPassThroughEnv": [
168
"XDG_CACHE_HOME",
179
"SANDBOX",
@@ -67,7 +59,6 @@
6759
"^build",
6860
"build",
6961
"generate",
70-
"//#typecheck:node",
7162
"test:types"
7263
],
7364
"cache": true
@@ -128,8 +119,7 @@
128119
"outputLogs": "new-only",
129120
"dependsOn": [
130121
"^build",
131-
"build",
132-
"//#test:scripts"
122+
"build"
133123
],
134124
"outputs": [
135125
"coverage/**"
@@ -161,7 +151,10 @@
161151
"PLAYWRIGHT_BROWSERS_PATH",
162152
"FONTCONFIG_FILE"
163153
],
164-
"cache": true
154+
"cache": true,
155+
"inputs": [
156+
"$TURBO_DEFAULT$"
157+
]
165158
},
166159
"test:types": {
167160
"inputs": [
@@ -225,7 +218,6 @@
225218
"inputs": [
226219
"$TURBO_DEFAULT$",
227220
"oxlint.config.ts",
228-
"$TURBO_ROOT$/oxlint.shared.ts",
229221
"tsconfig.json",
230222
"tsconfig.*.json",
231223
"!**/*.md"
@@ -235,8 +227,6 @@
235227
"^build",
236228
"build",
237229
"generate",
238-
"//#lint:suppressions",
239-
"//#format:check",
240230
"lint:tsgo"
241231
],
242232
"env": [

0 commit comments

Comments
 (0)