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.
@@ -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
- const NAV_FILE = path.join(ROOT, "nav", "nav.yml")
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;">Game Warden Help Center</span>
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
- const authCtx = await browser.newContext()
153
- const authPage = await authCtx.newPage()
154
- await authPage.goto(`${BASE_URL}/login`, { waitUntil: "networkidle" })
155
- // Click "Staff (vendor + admin)" persona button
156
- await authPage.click("button:has-text('Staff')")
157
- await authPage.waitForURL(/\/home|\/getting-started/, { timeout: 10000 })
158
- const cookies = await authCtx.cookies()
159
- await authPage.close()
160
- await authCtx.close()
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