Files
paseo/packages/website/vite.config.ts
Mohamed Boudra dec47d72d9 docs: lowercase internal docs + migrate website docs to public-docs/ (#634)
* docs: rename to lowercase + drop leftover plans

Rename docs in docs/ to lowercase kebab-case for consistency and update
all references in CLAUDE.md, CONTRIBUTING.md, CHANGELOG.md,
packages/server/CLAUDE.md, and inter-doc links.

Drop two leftover design plan docs:
- docs/ATTACHMENT_BASED_REVIEW_CONTEXT_PLAN.md
- docs/plan-approval-normalization.md

* docs: drop stale uppercase entries from case-insensitive rename

* feat(website): power /docs from public-docs/ markdown tree

Move website docs out of TSX route components and into a root-level
public-docs/ directory of plain markdown files with frontmatter
(title, description, nav, order).

- Add packages/website/src/docs.ts loader using import.meta.glob with
  ?raw to compile the markdown into the bundle at build time.
- Replace the 9 hand-written docs/*.tsx routes with a single $.tsx
  catch-all that renders any slug via react-markdown.
- Drive the docs sidebar nav from frontmatter order/nav.
- Auto-discover docs routes in vite.config.ts so the sitemap stays in
  sync without manual edits.

* fix(website): bind dev server to 0.0.0.0 so port collisions trigger fallback

`host: "127.0.0.1"` (or unset) lets macOS coexist with another process
holding an IPv6 dual-stack `*:8082` socket, so Vite never sees
EADDRINUSE and silently binds alongside it. Forcing IPv4 wildcard
makes the conflict real, and Vite's default `strictPort: false`
falls through to the next free port.

* fix(website): restore docs page styling after markdown migration

Add a .docs-prose class that mirrors the styling the original
docs/*.tsx components hand-rolled (h1/h2/h3 sizes, paragraph/list
spacing, link colors, code blocks, callout-style blockquotes).

ReactMarkdown was emitting unstyled HTML because the previous
wrapper class only had inline-code rules — headings and code
blocks fell back to user-agent defaults.
2026-04-30 17:27:15 +08:00

75 lines
1.9 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { defineConfig, type UserConfig } from "vite";
import tsConfigPaths from "vite-tsconfig-paths";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { cloudflare } from "@cloudflare/vite-plugin";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
const repoRoot = path.resolve(__dirname, "../..");
const siteHost = "https://paseo.sh";
function discoverDocsRoutes(): string[] {
const docsDir = path.join(repoRoot, "public-docs");
if (!fs.existsSync(docsDir)) return ["/docs"];
const routes = new Set<string>(["/docs"]);
const walk = (dir: string) => {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) {
walk(full);
continue;
}
if (!entry.name.endsWith(".md")) continue;
const rel = path.relative(docsDir, full).replace(/\.md$/, "");
if (rel === "index") continue;
routes.add(`/docs/${rel.split(path.sep).join("/")}`);
}
};
walk(docsDir);
return [...routes].sort();
}
const sitemapPages = [
"/",
"/changelog",
"/claude-code",
"/codex",
"/download",
"/opencode",
"/privacy",
...discoverDocsRoutes(),
].map((routePath) => ({
path: routePath,
}));
export default defineConfig((): UserConfig => {
return {
server: {
host: "0.0.0.0",
port: 8082,
strictPort: false,
fs: {
allow: [repoRoot],
},
},
plugins: [
cloudflare({ viteEnvironment: { name: "ssr" } }),
tsConfigPaths(),
tanstackStart({
router: {
quoteStyle: "double",
semicolons: true,
},
pages: sitemapPages,
sitemap: {
host: siteHost,
},
}),
react(),
tailwindcss(),
],
};
});