Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ yarn-error.log*
public/sitemap.xml
# Per-source llms files (generated by build:llms, served by www)
public/llms/
# Generated guide markdown files
public/docs/
# Generated guide and reference markdown files
public/markdown/
public/docs.tar.gz

# Copied examples folder
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To test locally, within the `apps/docs` directory:
1. Run `pnpm build:guides-markdown`
2. Run `pnpm dev`

This creates Markdown files for all routes under the `public/docs/guides` directory, ignored by Git.
This creates Markdown files for all routes under the `public/markdown/guides` directory, ignored by Git.

For production this setup runs as a `prebuild` task to allow Vercel to bundle these files with middleware and functions.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/app/api/guides-md/[...slug]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NextResponse } from 'next/server'

export async function GET(request: Request, { params }: { params: Promise<{ slug: string[] }> }) {
const { slug } = await params
const baseDir = path.join(process.cwd(), 'public/docs/guides')
const baseDir = path.join(process.cwd(), 'public/markdown/guides')
const filePath = path.join(baseDir, `${slug.join('/')}.md`)

if (!filePath.startsWith(baseDir + path.sep) && filePath !== baseDir) {
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/internals/generate-guides-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ async function generate() {
await Promise.all(
files.map(async (filePath) => {
const outPath = filePath
.replace(/^content\/guides\//, 'public/docs/guides/')
.replace(/^content\/guides\//, 'public/markdown/guides/')
.replace(/\.mdx$/, '.md')

let output: string
Expand Down Expand Up @@ -234,16 +234,16 @@ async function generate() {
}
}

// content/guides/ai/vector-columns.mdx → public/docs/guides/ai/vector-columns.md
// Placing under public/docs/ ensures the file is served at /docs/guides/...
// content/guides/ai/vector-columns.mdx → public/markdown/guides/ai/vector-columns.md
// Placing under public/markdown/ ensures the file is served at /docs/guides/...
// matching the exact URL of the rendered page.
await fs.promises.mkdir(path.dirname(outPath), { recursive: true })
await fs.promises.writeFile(outPath, output)
})
)

const summary = warnings ? ` (${warnings} with warnings)` : ''
console.log(`Generated ${files.length} markdown files under public/docs/guides/${summary}`)
console.log(`Generated ${files.length} markdown files under public/markdown/guides/${summary}`)
}

generate()
4 changes: 2 additions & 2 deletions apps/docs/internals/generate-gz-archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ async function generate() {
// Create a tar.gz archive of the generated docs, served at /docs/docs.tar.gz.
// Sorted entries, portable headers, and a fixed mtime keep the output deterministic.
const archivePath = 'public/docs.tar.gz'
const entries = (await globby(['**'], { cwd: 'public/docs' })).sort()
const entries = (await globby(['**'], { cwd: 'public/markdown' })).sort()
await createTar(
{ gzip: true, file: archivePath, cwd: 'public/docs', portable: true, mtime: new Date() },
{ gzip: true, file: archivePath, cwd: 'public/markdown', portable: true, mtime: new Date() },
entries
)
console.log(`Created archive at ${archivePath}`)
Expand Down
Loading
Loading