mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-09 00:16:23 +08:00
feat(docs): update configuration and improve caching for documentation site
- Added Cloudflare and OpenNext configurations to .gitignore. - Updated next.config.mjs to disable image optimization for better performance with CDN. - Modified fetchJson function in github.ts to use 'force-cache' for improved data fetching efficiency. - Updated multiple image assets for the documentation site.
This commit is contained in:
@@ -27,3 +27,8 @@ yarn-error.log*
|
|||||||
.env*.local
|
.env*.local
|
||||||
.vercel
|
.vercel
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
|
# cloudflare / opennext
|
||||||
|
/.open-next/
|
||||||
|
/.wrangler/
|
||||||
|
cloudflare-env.d.ts
|
||||||
@@ -7,9 +7,10 @@ export type RepoStats = {
|
|||||||
|
|
||||||
async function fetchJson(url: string): Promise<Record<string, unknown> | null> {
|
async function fetchJson(url: string): Promise<Record<string, unknown> | null> {
|
||||||
try {
|
try {
|
||||||
|
// 构建期取一次并静态化;数据随每次部署更新,运行时无需 ISR 缓存设施
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
headers: { Accept: 'application/vnd.github+json' },
|
headers: { Accept: 'application/vnd.github+json' },
|
||||||
next: { revalidate: 3600 },
|
cache: 'force-cache',
|
||||||
});
|
});
|
||||||
if (!res.ok) return null;
|
if (!res.ok) return null;
|
||||||
return (await res.json()) as Record<string, unknown>;
|
return (await res.json()) as Record<string, unknown>;
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ const withMDX = createMDX();
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
images: {
|
||||||
|
// 站内图片均为已按展示尺寸截取的静态资源,直接由 CDN 提供,
|
||||||
|
// 避免在 Cloudflare Workers 上依赖运行时图片优化服务。
|
||||||
|
unoptimized: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withMDX(config);
|
export default withMDX(config);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 114 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 231 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 244 KiB |
Reference in New Issue
Block a user