Skip to content

Commit decac4b

Browse files
docs: fix link-checker file discovery (#10348)
### Description The broken link checker lost its discovery of the MDX files so it wasn't reporting issues. Also fixes some links that went broken while this analysis was broken. ### Testing Instructions [This run](https://github.com/vercel/turborepo/actions/runs/14514917931/job/40721676278?pr=10348) shows broken links being discovered again, so we know the root problem is fixed. --------- Co-authored-by: Chris Olszewski <[email protected]>
1 parent bf4c350 commit decac4b

File tree

11 files changed

+44
-17
lines changed

11 files changed

+44
-17
lines changed

docs/link-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"src"
77
],
88
"scripts": {
9-
"check-links": "tsx src/validate-docs-links.ts"
9+
"check-links": "cd ../site/content && tsx ../../link-checker/src/validate-docs-links.ts"
1010
},
1111
"devDependencies": {
1212
"@types/node": "22.7.8",

docs/link-checker/src/markdown.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ export type LinkError = {
3535

3636
/** where to look for docs (.mdx files) */
3737
const DOCS_PATH = ".";
38-
const EXCLUDED_HASHES = ["top"];
38+
const EXCLUDED_HASHES: string[] = [
39+
// Start: hashlinks created by Fumadocs
40+
"create-turbo-config",
41+
"add-package-manager",
42+
"set-default-outputs",
43+
// End: hashlinks created by Fumadocs
44+
];
3945

4046
/** These paths exist, just not in our Markdown files */
41-
const EXCLUDED_PATHS = ["/api/remote-cache-spec", "/repo"];
47+
const EXCLUDED_PATHS = ["/api/remote-cache-spec", "/discord", "/docs/openapi"];
4248

4349
const slugger = new GitHubSlugger();
4450

@@ -86,7 +92,8 @@ const markdownProcessor = unified()
8692
});
8793

8894
const filePathToUrl = (filePath: string): string =>
89-
filePath.replace("docs", "/docs").replace(".mdx", "");
95+
// "/" prefix makes it easier to compare internal links
96+
"/" + filePath.replace(".mdx", "");
9097

9198
const validateFrontmatter = (path: string, data: Record<string, unknown>) => {
9299
if (!data.title) {
@@ -190,6 +197,23 @@ const validateHashLink = (doc: Document, href: string) => {
190197
return [];
191198
}
192199

200+
if (
201+
doc.headings.includes(
202+
// Handles when the link has the experimental badge in it.
203+
// Because we're parsing the raw document (not the rendered output), the JSX declaration is still present.
204+
hashLink.replace(
205+
"-experimental",
206+
"-experimentalbadgeexperimentalexperimentalbadge"
207+
)
208+
)
209+
) {
210+
console.warn(
211+
`The hash link "${hashLink}" passed when including the <ExperimentalBadge /> JSX declaration.`
212+
);
213+
console.log();
214+
return [];
215+
}
216+
193217
let linkError: LinkError = {
194218
type: "hash",
195219
href,
@@ -235,6 +259,9 @@ const traverseTreeAndValidateLinks = (
235259
*/
236260
export const collectLinkErrors = async (): Promise<LinkError[]> => {
237261
const allMdxFilePaths = await getAllMdxFilePaths();
262+
if (allMdxFilePaths.length === 0) {
263+
throw new Error("No files were found for processing.");
264+
}
238265

239266
const documentMap = new Map(
240267
await Promise.all(allMdxFilePaths.map(prepareDocumentMapEntry))

docs/site/content/blog/turbo-1-10-0.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Turborepo Generators allow you to add new code to your repository in a predictab
5757
Previously, you would need to copy code yourself and manually add dependencies to your new workspace. With Generators,
5858
we've automated the process of creating new workspaces and integrating them into your repository.
5959

60-
You can [create a blank workspace from scratch](/docs/guides/generating-code#add-an-empty-workspace), [copy an existing workspace](/docs/guides/generating-code#copy-an-existing-workspace), or even create custom generators
60+
You can [create a blank workspace from scratch](/docs/guides/generating-code#add-an-empty-package), [copy an existing workspace](/docs/guides/generating-code#copy-an-existing-package), or even create custom generators
6161
for more control. Custom generators leverage [Plop](https://plopjs.com/) configurations, a common template definition strategy used in the JavaScript ecosystem.
6262

6363
[Custom generators](/docs/guides/generating-code#custom-generators) can also be used to scaffold more granular sets of code than workspaces. You can significantly speed up tasks like:
@@ -122,7 +122,7 @@ To ensure that Turborepo includes these variables in your hash, use the `dotEnv`
122122
included in your hash.
123123
</Callout>
124124

125-
For more, check out the [documentation](/docs/reference/configuration#dotenv).
125+
For more, check out the documentation.
126126

127127
### Environment Variable Wildcards
128128

@@ -141,7 +141,7 @@ With wildcards, you can now specify patterns of variables to include in your has
141141
}
142142
```
143143

144-
For more, check out the [documentation](/docs/crafting-your-repository/using-environment-variables#wildcards).
144+
For more, check out the [documentation](/docs/reference/configuration#wildcards).
145145

146146
### Environment modes
147147

docs/site/content/blog/turbo-1-11-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ We're putting a renewed effort towards ensuring our examples are kept up-to-date
9393
- Tooling like ESLint, Prettier, jest, and vitest pre-configured
9494
- Hot-reloading across packages
9595

96-
[Use an example](/docs/getting-started/installation#start-with-an-example) to get started, or [browse the code directly](https://github.com/vercel/turbo/tree/main/examples) for more.
96+
[Use an example](/docs/getting-started/examples) to get started, or [browse the code directly](https://github.com/vercel/turbo/tree/main/examples) for more.
9797

9898
## Community
9999

docs/site/content/blog/turbo-1-12-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Turborepo 1.12 adds popular community-requested features and feedback improvemen
2020

2121
- [**Colors in task logs**](#colors-in-task-logs): Colors from original shell logs used by default
2222
- [**Errors overhaul**](#errors-overhaul): Improved error messages for misconfigurations
23-
- [**Improved `inputs` ergonomics**](#improved---inputs-ergonomics): Use Turborepo's defaults with your input customizations
23+
- [**Improved `inputs` ergonomics**](#improved-inputs-ergonomics): Use Turborepo's defaults with your input customizations
2424
- [**Telemetry**](#telemetry): Help us focus on what matters most to Turborepo users
2525

2626
We're also done cleaning up our migration to Rust in this release by removing the `--go-fallback` flag and shrinking the `turbo` binary by 58% compared to 1.11.

docs/site/content/blog/turbo-1-7-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Also note that you will no longer need to specify `outputs: []` because not cach
134134
## “Errors only” output mode for quieter logs
135135

136136
To bring visibility to errors, community member [@dobesv](https://github.com/dobesv) contributed [a solution to only show errors instead of all logs from a task run](https://github.com/vercel/turbo/pull/2588). While debugging a pipeline, `--output-logs=errors-only` can be used to keep your signal-to-noise ratio high so you can focus on ensuring successful runs for your pipelines.
137-
This can be used as a [configuration option](/docs/reference/configuration#outputmode) or as a [CLI flag](/docs/reference/run#--output-logs)
137+
This can be used as a [configuration option](/docs/reference/configuration#outputlogs) or as a [CLI flag](/docs/reference/run#--output-logs-option)
138138

139139
```bash title="Terminal"
140140
turbo build --output-logs=errors-only

docs/site/content/blog/turbo-1-9-0.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Turborepo 1.9 focuses on improving observability for your task runs to better un
3232

3333
- [**Run Summaries**](#view-and-compare-task-runs): Use the `--summarize` flag to generate a summary of your task to compare against previous runs.
3434
- [**Easier Starters**](#bring-your-own-starter): Use the `--example` flag with `npx create-turbo` to start from official Turborepo examples or custom repositories.
35-
- [**Strict Environments** <ExperimentalBadge isLink={false} />](#strict-environments): Try enabling strict mode to restrict the environment variables your tasks have access to.
35+
- [**Strict Environments** <ExperimentalBadge isLink={false} />](#strict-environments-experimental): Try enabling strict mode to restrict the environment variables your tasks have access to.
3636

3737
Update today by running `npx @turbo/codemod migrate`.
3838

@@ -106,7 +106,7 @@ In `strict` mode, this configuration will only expose four environment variables
106106

107107
`--env-mode` also supports `loose` and `infer`.
108108

109-
Learn more in the [docs](/docs/reference/run#--env-mode).
109+
Learn more in the [docs](/docs/reference/run#--env-mode-option).
110110

111111
## Community
112112

docs/site/content/blog/turbo-2-0.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Turborepo 2.0 improves the developer experience of JavaScript and TypeScript rep
2222
- [**New terminal UI**](#new-terminal-ui): Interactive tasks and clearer logs
2323
- [**Watch Mode**](#watch-mode): Dependency-aware task watcher for any tooling in your repository
2424
- [**All-new documentation**](#all-new-documentation): Core monorepo concepts, refreshed API reference, and ecosystem tooling guides
25-
- **Licensing and maintenance updates**: Upgraded to MIT license and added [Long Term Support policy](/docs/getting-started/support-policy#lts-policy)
25+
- **Licensing and maintenance updates**: Upgraded to MIT license and added [Long Term Support policy](/docs/support-policy#lts-policy)
2626

2727
Update today by running `npx @turbo/codemod migrate` or get started with `npx create-turbo@latest`.
2828

@@ -136,7 +136,7 @@ Visit [the upgrading guide](/docs/crafting-your-repository/upgrading#upgrading-t
136136

137137
### Other
138138

139-
- Minimum package manager version support for npm and pnpm updated to 8 ([Source](/docs/getting-started/support-policy#package-managers))
139+
- Minimum package manager version support for npm and pnpm updated to 8 ([Source](/docs/support-policy#package-managers))
140140
- Remove package manager argument from `create-turbo`, replaced by option ([PR](https://github.com/vercel/turbo/pull/8150))
141141

142142
## Community

docs/site/content/blog/turbo-2-3.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This is more convenient than the equivalent command using `--filter` (`turbo run
8686
turbo run web#build docs#lint
8787
```
8888

89-
[Learn more in the documentation.](/docs/crafting-your-repository/running-tasks#filtering-by-package-name)
89+
[Learn more in the documentation.](/docs/crafting-your-repository/running-tasks#filtering-by-package)
9090

9191
## Simplified cache control
9292

docs/site/content/docs/guides/tools/typescript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ First, add a `check-types` script to any package that you want to check the type
218218
}
219219
```
220220

221-
Then, create a `check-types` task in `turbo.json`. From the [Configuring tasks guide](/docs/crafting-your-repository/configuring-tasks#dependent-tasks-that-can-be-ran-in-parallel), we can make the task run in parallel while respecting source code changes from other packages using a [Transit Node](/docs/core-concepts/package-and-task-graph#transit-nodes):
221+
Then, create a `check-types` task in `turbo.json`. From the [Configuring tasks guide](/docs/crafting-your-repository/configuring-tasks#dependent-tasks-that-can-be-run-in-parallel), we can make the task run in parallel while respecting source code changes from other packages using a [Transit Node](/docs/core-concepts/package-and-task-graph#transit-nodes):
222222

223223
```json title="./turbo.json"
224224
{

docs/site/content/docs/reference/configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Set/limit the maximum concurrency for task execution. Must be an integer greater
9999

100100
- Use `1` to force serial execution (one task at a time).
101101
- Use `100%` to use all available logical processors.
102-
- This option is ignored if the [`--parallel`](#--parallel) flag is also passed.
102+
- This option is ignored if the [`--parallel`](/docs/reference/run#--parallel) flag is also passed.
103103

104104
```jsonc title="./turbo.json"
105105
{

0 commit comments

Comments
 (0)