Skip to content

Commit 47fd232

Browse files
committed
extend failed links summary with source
1 parent fe11252 commit 47fd232

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

scripts/checkLinks.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,27 @@ async function main(): Promise<void> {
118118
for (const [index, file] of files.entries()) {
119119
const { file: filePath, links } = file
120120
process.stdout.write(`${index + 1} ${filePath} `)
121-
failedLinks.push(...(await checkLinksInFile(filePath, links)))
121+
failedLinks.push(
122+
...(await checkLinksInFile(filePath, links)).map(
123+
(l) => `${filePath}: ${l}`,
124+
),
125+
)
122126
process.stdout.write('\n')
123127
}
124128

125129
console.log('Checking links in Vercel.json')
126130
failedLinks.push(
127-
...(await checkLinksInFile(
128-
'vercel.json',
129-
vercelConfig.redirects.map((l) => l.destination),
130-
)),
131+
...(
132+
await checkLinksInFile(
133+
'vercel.json',
134+
vercelConfig.redirects.map((l) => l.destination),
135+
)
136+
).map((l) => `vercel.json: ${l}`),
131137
)
132138

133-
const dedupedFailedLinks = [...new Set(failedLinks)]
134-
135139
if (failedLinks.length > 0) {
136140
console.error('\nThe following links are broken:')
137-
for (const link of dedupedFailedLinks) {
141+
for (const link of failedLinks) {
138142
console.error(link)
139143
}
140144
process.exit(1)

0 commit comments

Comments
 (0)