Files
orca/docs/site/next.config.ts
T
Neil 6aba202d5e feat(docs): publish OSS docs with stable releases
Publish the standalone docs site under docs/site and deploy it on stable desktop releases.
2026-08-30 23:51:25 -07:00

59 lines
1.8 KiB
TypeScript

import { createMDX } from 'fumadocs-mdx/next'
import type { NextConfig } from 'next'
// Keep human-facing animations intact while preventing crawlers from burning
// transfer on multi-MB demo GIFs (serve JPG posters instead).
const crawlerUserAgentPattern =
'.*(?:[Bb][Oo][Tt]|[Cc][Rr][Aa][Ww][Ll]|[Ss][Pp][Ii][Dd][Ee][Rr]|GPTBot|ChatGPT-User|OAI-SearchBot|ClaudeBot|Claude-User|anthropic-ai|PerplexityBot|CCBot|Google-Extended|Applebot|facebookexternalhit|Twitterbot|LinkedInBot|Slackbot|Discordbot|TelegramBot|WhatsApp|SkypeUriPreview|Pinterest|Ahrefs|Semrush|MJ12|DotBot|PetalBot|Bytespider|Amazonbot|DuckDuckBot|Baiduspider|Yandex).*'
const crawlerGifPosterRewrites = [
['/docs/orca-design-mode.gif', '/docs/posters/orca-design-mode.jpg'],
['/docs/tab-split.gif', '/docs/posters/tab-split.jpg']
] as const
const nextConfig: NextConfig = {
// Keep this zone's Next assets separate from the marketing zone.
assetPrefix: '/docs-static',
turbopack: {
root: process.cwd()
},
async rewrites() {
const crawlerUserAgent = [
{
type: 'header' as const,
key: 'user-agent',
value: crawlerUserAgentPattern
}
]
return {
beforeFiles: crawlerGifPosterRewrites.map(([source, destination]) => ({
source,
destination,
has: crawlerUserAgent
}))
}
},
async headers() {
const media = 'public, max-age=2592000, stale-while-revalidate=86400'
return [
{
source: '/docs/:all*(mp4|gif)',
headers: [{ key: 'Cache-Control', value: media }]
},
{
source: '/docs/posters/:path*',
headers: [{ key: 'Cache-Control', value: media }]
},
{
source: '/docs/videos/:path*',
headers: [{ key: 'Cache-Control', value: media }]
}
]
}
}
const withMDX = createMDX()
export default withMDX(nextConfig)