Skip to content

Commit 0103fd8

Browse files
authored
[DO NOT MERGE] feat(docs): $TURBO_DEFAULT$ (#7155)
### Description Docs for #7113 Depends on #7113 Closes TURBO-2184
1 parent 5b07ad4 commit 0103fd8

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

docs/pages/repo/docs/core-concepts/caching.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Now, make sure that `turbo` is aware of the file by adding it to task inputs. Yo
130130
"pipelines": {
131131
"build-for-platforms": {
132132
"dependsOn": ["^build"],
133-
"inputs": ["turbo-cache-key.json", ...]
133+
"inputs": ["$TURBO_DEFAULT$", "turbo-cache-key.json"]
134134
}
135135
}
136136
}

docs/pages/repo/docs/core-concepts/caching/file-inputs.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ You should aim to have both Git and the Git index of your repository available f
7171

7272
<Callout>
7373
Customizing the `inputs` immediately opts out of the default behavior. You must manually specify via `pipeline.<task>.inputs` all of the files that should be considered.
74+
75+
For convienence, you can use the special string `$TURBO_DEFAULT$` within an inputs array to automatically include all files considered in the default behavior. This allows
76+
you to customize the inputs without needing to manually specify all of the files that would have been considered by default.
77+
7478
</Callout>
7579

7680
For some tasks it is worthwhile to reduce the number of file inputs into the task hash consideration. Very few tasks depend on the contents of `README.md`. Specifying just the files that matter can increase the frequency of cache hits.
@@ -114,3 +118,16 @@ If a task depends on another task which specifies file dependencies they do not
114118
```
115119

116120
This pattern can be used to save yourself from needing to repetitively enumerate a list of file globs for every single task.
121+
122+
You may also want to keep the default behavior, but only include, or exclude a few files. You can use the special string `$TURBO_DEFAULT$` to include all of the files that would have been considered by default:
123+
124+
```jsonc filename="/turbo.json"
125+
{
126+
"$schema": "https://turbo.build/schema.json",
127+
"pipeline": {
128+
"build": {
129+
"inputs": ["$TURBO_DEFAULT$", "!README.md", "a-git-ignored-file.txt"]
130+
}
131+
}
132+
}
133+
```

docs/pages/repo/docs/reference/configuration.mdx

+20-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,12 @@ Defaults to `true`. Whether or not to cache the task [`outputs`](#outputs). Sett
361361

362362
Tells `turbo` the set of files to consider when determining if a package has changed for a particular task.
363363
Setting this to a list of globs will cause the task to only be run when files matching those globs have
364-
changed. This can be helpful if you want to, for example, skip running tests unless a source file changed.
364+
changed. This can be helpful if you want to, for example, skip running tests unless a source file changed, or
365+
explicitly depend on a `.gitignore`d file.
366+
367+
Because specifying an `inputs` key immediately opts out of the default behavior, you may specify
368+
the special string `$TURBO_DEFAULT$` within an inputs array to include all default inputs. This is useful
369+
if you want to add or remove additional inputs from the default set.
365370

366371
The default is `[]` to run the task when any file in the package changes.
367372

@@ -384,6 +389,20 @@ The default is `[]` to run the task when any file in the package changes.
384389
}
385390
```
386391

392+
`$TURBO_DEFAULT$` **Example**
393+
394+
```jsonc
395+
{
396+
"$schema": "https://turbo.build/schema.json",
397+
"pipeline": {
398+
"check-types": {
399+
// Consider all default inputs except the README.md
400+
"inputs": ["$TURBO_DEFAULT$", "!README.md"],
401+
}
402+
}
403+
}
404+
```
405+
387406
<Callout type="info">
388407
Note: `turbo.json` is *always* considered an input. If you modify
389408
`turbo.json`, all caches are invalidated.

0 commit comments

Comments
 (0)