mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
docs: link v1 docs from header
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import path from "node:path"
|
||||
|
||||
const root = path.resolve(import.meta.dir, "../dist/client")
|
||||
const externalRoutes = new Set(["/docs"])
|
||||
const files = await Array.fromAsync(new Bun.Glob("**/*.html").scan({ cwd: root, absolute: true }))
|
||||
const failures = (
|
||||
await Promise.all(
|
||||
@@ -11,6 +12,7 @@ const failures = (
|
||||
Array.from(html.matchAll(/href="([^"]+)"/g), async (match) => {
|
||||
const url = new URL(match[1], page)
|
||||
if (url.origin !== "https://opencode.local") return
|
||||
if (externalRoutes.has(url.pathname)) return
|
||||
|
||||
const targetPath = path.join(root, decodeURIComponent(url.pathname))
|
||||
const target = (
|
||||
|
||||
@@ -23,6 +23,7 @@ const searchEnabled = import.meta.env.PROD
|
||||
</a>
|
||||
))
|
||||
}
|
||||
<a href="/docs">V1</a>
|
||||
</nav>
|
||||
<div class="header-spacer"></div>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user