camelmind 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +224 -6
- package/package.json +1 -1
- package/template/_package.json +4 -0
- package/template/app/[...slug]/page.tsx +1 -1
- package/template/app/api/llms/[...slug]/route.ts +34 -0
- package/template/app/api/raw/route.ts +34 -1
- package/template/app/api-reference/[[...slug]]/page.tsx +65 -22
- package/template/app/globals.css +1 -2
- package/template/app/llms.txt/route.ts +36 -0
- package/template/components/ApiReference/ApiSidebar.tsx +66 -5
- package/template/components/Nav/TopNav.tsx +1 -1
- package/template/components/Nav/VersionSelector.tsx +8 -0
- package/template/components/mdx/Callout.tsx +3 -1
- package/template/components/mdx/LLMIgnore.tsx +4 -0
- package/template/components/mdx/LLMOnly.tsx +4 -0
- package/template/components/mdx/index.tsx +4 -0
- package/template/lib/api-reference.ts +8 -9
- package/template/lib/config-types.ts +12 -1
- package/template/lib/config.ts +1 -1
- package/template/lib/mdx.ts +13 -0
- package/template/lib/nav.ts +72 -3
- package/template/lib/versions.ts +62 -26
- package/template/proxy.ts +10 -1
- package/template/scripts/build-offline.sh +43 -5
- package/template/scripts/build-pdf.sh +3 -3
- package/template/scripts/build-search-index.ts +7 -1
- package/template/scripts/generate-master-pdf.ts +9 -17
- package/template/scripts/generate-pdfs.ts +26 -12
- package/template/public/2f-logo.png +0 -0
|
@@ -13,14 +13,25 @@ import { SignJWT } from "jose"
|
|
|
13
13
|
import fs from "fs"
|
|
14
14
|
import path from "path"
|
|
15
15
|
import yaml from "js-yaml"
|
|
16
|
+
import config from "../camelmind.config"
|
|
17
|
+
|
|
18
|
+
const SITE_TITLE = config.title
|
|
16
19
|
|
|
17
20
|
const ROOT = path.resolve(process.cwd())
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
// Resolve the latest stable version's nav file from versions.yml
|
|
23
|
+
const { versions: _versions } = yaml.load(fs.readFileSync(path.join(ROOT, "versions.yml"), "utf-8")) as {
|
|
24
|
+
versions: { id: string; stable: boolean; nav: string }[]
|
|
25
|
+
}
|
|
26
|
+
const _latestVersion = _versions.find((v) => v.stable) ?? _versions[0]
|
|
27
|
+
const NAV_FILE = path.join(ROOT, _latestVersion.nav)
|
|
19
28
|
|
|
20
29
|
const PORT = parseInt(process.argv.find((a) => a.startsWith("--port="))?.split("=")[1] ?? "3000")
|
|
21
30
|
const OUT_DIR = process.argv.find((a) => a.startsWith("--out="))?.split("=")[1]
|
|
22
31
|
? path.resolve(process.argv.find((a) => a.startsWith("--out="))!.split("=")[1])
|
|
23
32
|
: path.join(ROOT, ".pdf-pages")
|
|
33
|
+
// --no-auth: skip the login step (use when rendering a static offline export where auth is bypassed)
|
|
34
|
+
const SKIP_AUTH = process.argv.includes("--no-auth")
|
|
24
35
|
|
|
25
36
|
const CONCURRENCY = 4
|
|
26
37
|
const BASE_URL = `http://localhost:${PORT}`
|
|
@@ -110,7 +121,7 @@ async function generatePage(
|
|
|
110
121
|
headerTemplate: `
|
|
111
122
|
<div style="width:100%;font-family:system-ui,sans-serif;font-size:8px;color:#6b7280;display:flex;justify-content:space-between;padding:0 16mm;">
|
|
112
123
|
<span>${page.group}${page.section ? " › " + page.section : ""}</span>
|
|
113
|
-
<span style="color:#111827;font-weight:600;"
|
|
124
|
+
<span style="color:#111827;font-weight:600;">${SITE_TITLE}</span>
|
|
114
125
|
</div>`,
|
|
115
126
|
footerTemplate: `
|
|
116
127
|
<div style="width:100%;font-family:system-ui,sans-serif;font-size:8px;color:#6b7280;display:flex;justify-content:space-between;padding:0 16mm;">
|
|
@@ -148,16 +159,19 @@ async function main() {
|
|
|
148
159
|
|
|
149
160
|
const browser = await chromium.launch()
|
|
150
161
|
|
|
151
|
-
// Sign in via the dev login UI so we get a real session cookie
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
// Sign in via the dev login UI so we get a real session cookie.
|
|
163
|
+
// Skip when rendering against a static offline export (auth is bypassed there).
|
|
164
|
+
let cookies: Cookie[] = []
|
|
165
|
+
if (!SKIP_AUTH) {
|
|
166
|
+
const authCtx = await browser.newContext()
|
|
167
|
+
const authPage = await authCtx.newPage()
|
|
168
|
+
await authPage.goto(`${BASE_URL}/login`, { waitUntil: "networkidle" })
|
|
169
|
+
await authPage.click("button:has-text('Staff')")
|
|
170
|
+
await authPage.waitForURL(/\/home|\/getting-started/, { timeout: 10000 })
|
|
171
|
+
cookies = await authCtx.cookies()
|
|
172
|
+
await authPage.close()
|
|
173
|
+
await authCtx.close()
|
|
174
|
+
}
|
|
161
175
|
|
|
162
176
|
const results: Array<{ page: PageEntry; file: string }> = []
|
|
163
177
|
|
|
Binary file
|