scripts/verify-links: verify links in changesets

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-10-24 12:55:06 +02:00
parent b24a1cb45d
commit 8f91b281c7
+8
View File
@@ -77,6 +77,10 @@ async function verifyUrl(basePath, absUrl, docPages) {
return undefined;
}
if (basePath.startsWith('.changeset/')) {
return { url, basePath, problem: 'out-of-changeset' };
}
let path = '';
if (url.startsWith('/')) {
@@ -195,6 +199,10 @@ async function main() {
'',
)}`,
);
} else if (problem === 'out-of-changeset') {
console.error('Links in changesets must use absolute URLs');
console.error(` From: ${basePath}`);
console.error(` To: ${url}`);
} else if (problem === 'doc-missing') {
const suggestion =
docPages.get(url) ||