docs(sw): Popup guidance, example comments, package README and link check

This commit is contained in:
shkim4 committed 2026-10-20 21:49:47 +09:00
1 parent 2ce24b8b43
commit e32a138f28
7 files changed
+92 -91

No files matched your search

+4
View File
@@ -48,6 +48,10 @@ for (const doc of [...docs.map(name => path.join("ai", name)), "README.md"]) {
const links = [...text.matchAll(/\]\((\.\/[^)#\s]+)/g)].map(match => match[1])
const broken = links.filter(link => !existsSync(path.resolve(root, path.dirname(doc), link)))
check(`${doc}: package-relative links resolve`, broken.length === 0, { links: links.length, broken })
// Any other relative link (e.g. ../../docs/...) points outside the published package and breaks once installed.
const relative = [...text.matchAll(/\]\(([^)\s]+)\)/g)].map(match => match[1]).filter(link => !/^(?:[a-z][a-z0-9+.-]*:|#|\/|\.\/)/i.test(link))
const outside = relative.filter(link => path.relative(root, path.resolve(root, path.dirname(doc), link.split("#")[0])).startsWith(".."))
check(`${doc}: no links outside the package`, outside.length === 0, { links: relative.length, outside })
}
console.log(`${results.filter(Boolean).length}/${results.length} PASS`)
process.exitCode = results.every(Boolean) ? 0 : 1