-
Notifications
You must be signed in to change notification settings - Fork 91
refactor(docs): switch to VitePress Plus theme with multi-version builds #6010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { defineConfig } from "vitepress"; | ||
| import { defineConfig } from "@lando/vitepress-theme-default-plus/config"; | ||
| import fs from "node:fs"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
@@ -15,6 +15,10 @@ import { | |
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| const docsDir = path.resolve(__dirname, ".."); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] runtime-mechanism The version variable reads .version from package.json, which has no version field in the repo. The ?? "dev" fallback always triggers for local and PR CI builds. The mechanism is intentional: mvb injects the version into package.json during tagged-release sub-builds in a temp checkout, and doc-site.md documents this behavior. |
||
| const version = | ||
|
rh-hemartin marked this conversation as resolved.
rh-hemartin marked this conversation as resolved.
rh-hemartin marked this conversation as resolved.
|
||
| JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "..", "package.json"), "utf-8")) | ||
| .version ?? "dev"; | ||
|
|
||
| function getMarkdownFiles(dir: string, base: string): { text: string; link: string }[] { | ||
| const fullDir = path.resolve(docsDir, dir); | ||
| if (!fs.existsSync(fullDir)) return []; | ||
|
|
@@ -188,14 +192,18 @@ export default defineConfig({ | |
| }, | ||
|
|
||
| srcExclude: ["**/agents/icons/**", "**/testing/**"], | ||
|
|
||
| ignoreDeadLinks: true, | ||
|
|
||
| themeConfig: { | ||
| logo: "/img/logo.png", | ||
| logoLink: { link: "https://fullsend.sh", target: "_self" }, | ||
| siteTitle: "Fullsend", | ||
|
|
||
| multiVersionBuild: { | ||
| satisfies: ">=0.37.0", | ||
| build: "stable", | ||
| }, | ||
|
|
||
| nav: [ | ||
| { text: "Docs", link: "/guides/getting-started/", activeMatch: "^/(?!cli/)" }, | ||
| { text: "CLI Reference", link: "/cli/", activeMatch: "/cli/" }, | ||
|
|
@@ -382,6 +390,26 @@ export default defineConfig({ | |
| ], | ||
| }, | ||
|
|
||
| sidebarEnder: { | ||
| text: version, | ||
| collapsed: true, | ||
| items: [ | ||
| { | ||
| text: "Other Doc Versions", | ||
| items: [ | ||
| { rel: "mvb", text: "stable", target: "_blank", link: "/stable/" }, | ||
| { rel: "mvb", text: "edge", target: "_blank", link: "/edge/" }, | ||
| { rel: "mvb", text: "dev", target: "_blank", link: "/dev/" }, | ||
| { text: "<strong>see all versions</strong>", link: "/v/" }, | ||
| ], | ||
| }, | ||
| { | ||
| text: "Other Releases", | ||
| link: "https://github.com/fullsend-ai/fullsend/releases", | ||
| }, | ||
| ], | ||
| }, | ||
|
|
||
| socialLinks: [{ icon: "github", link: "https://github.com/fullsend-ai/fullsend" }], | ||
|
|
||
| editLink: { | ||
|
|
@@ -393,7 +421,10 @@ export default defineConfig({ | |
| provider: "local", | ||
| options: { | ||
| scopes: [ | ||
| { label: "Guides", prefixes: ["/docs/guides/", "/docs/agents/", "/docs/cli/", "/docs/runtimes"] }, | ||
| { | ||
| label: "Guides", | ||
| prefixes: ["/docs/guides/", "/docs/agents/", "/docs/cli/", "/docs/runtimes"], | ||
| }, | ||
| { | ||
| label: "Design Docs", | ||
| prefixes: ["/docs/problems/", "/docs/ADRs/", "/docs/normative/", "/docs/spikes/"], | ||
|
|
@@ -458,15 +489,15 @@ export default defineConfig({ | |
| shikiSetup: async (shiki) => { | ||
| await shiki.loadLanguage("toml"); | ||
| }, | ||
|
|
||
| preConfig: (md) => { | ||
| const defaultParse = md.parse.bind(md); | ||
| md.parse = (src: string, env: Record<string, unknown>) => { | ||
| const rel = (env?.relativePath as string) ?? ""; | ||
|
rh-hemartin marked this conversation as resolved.
|
||
| if (rel === "v/index.md") return defaultParse(src, env); | ||
| return defaultParse(escapeVueSyntax(src), env); | ||
| }; | ||
| }, | ||
| // Auto-add v-pre to inline code so `{{ }}` inside backticks is safe. | ||
| // Recommended by VitePress maintainer brc-dd: | ||
| // https://github.com/vuejs/vitepress/discussions/3724 | ||
| config: (md) => { | ||
|
rh-hemartin marked this conversation as resolved.
|
||
| const defaultCodeInline = md.renderer.rules.code_inline!; | ||
| md.renderer.rules.code_inline = (tokens, idx, options, env, self) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| declare module "@lando/vitepress-theme-default-plus/config" { | ||
| import type { UserConfig } from "vitepress"; | ||
|
|
||
| interface VPLThemeConfig { | ||
| sidebarEnder?: unknown; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] weak-type-declarations sidebarEnder and multiVersionBuild are typed as unknown in the declaration file, plus a catch-all [key: string]: unknown index signature. This provides minimal type safety for the VPL theme config extensions. Suggested fix: Define the shapes of sidebarEnder and multiVersionBuild to match their usage in config.ts. |
||
| multiVersionBuild?: unknown; | ||
| [key: string]: unknown; | ||
| } | ||
|
|
||
| export function defineConfig(config: UserConfig<VPLThemeConfig>): UserConfig<VPLThemeConfig>; | ||
| } | ||
|
|
||
| declare module "@lando/vitepress-theme-default-plus" { | ||
| import type { Theme } from "vitepress"; | ||
| const theme: Theme; | ||
| export default theme; | ||
| } | ||
|
|
||
| declare module "*.vue" { | ||
| import type { DefineComponent } from "vue"; | ||
| const component: DefineComponent; | ||
| export default component; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.