Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: detect and fix broken links (#416)
* docs: detect and fix broken links * ci: fix * ci: fix * chore: use custom script * chore: fix syntax error * chore: fix script * chore: remove unwanted changes * ci: test script on windows * ci: test script on windows * ci: use ubuntu runner * ci: uncomment steps
- Loading branch information
Showing
7 changed files
with
4,159 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const path = require("path"); | ||
const TapRender = require("@munter/tap-render"); | ||
const spot = require("tap-spot"); | ||
const hyperlink = require("hyperlink"); | ||
|
||
const tapRenderInstance = new TapRender(); | ||
|
||
tapRenderInstance.pipe(spot()).pipe(process.stdout); | ||
|
||
const skipPatterns = [ | ||
"https://", | ||
"fragment-redirect", | ||
path.normalize("_site/sponsors"), | ||
"/docs" | ||
]; | ||
|
||
const skipFilter = (report) => | ||
Object.values(report).some((value) => | ||
skipPatterns.some((pattern) => String(value).includes(pattern)) | ||
); | ||
|
||
(async () => { | ||
try { | ||
await hyperlink( | ||
{ | ||
inputUrls: ["../_site/index.html"], | ||
root: path.resolve(__dirname, "../_site"), | ||
canonicalRoot: "https://eslint.org/", | ||
recursive: true, | ||
internalOnly: true, | ||
pretty: true, | ||
concurrency: 25, | ||
skipFilter, | ||
}, | ||
tapRenderInstance | ||
); | ||
} catch (err) { | ||
console.log(err.stack); | ||
process.exit(1); | ||
} | ||
const results = tapRenderInstance.close(); | ||
|
||
process.exit(results.fail ? 1 : 0); | ||
})(); |