在原仓库历史之上同步本服务器上的全部演进: - 迁移至新服务器并重建 PG 数据库 + ddnc 开发域名绑定 - 全部依赖升级至最新(Next 16.3.5 / React 19.3 / better-auth 1.7.5 / Drizzle 0.45 / TS 7), overrides 消除已知 CVE,安全审计 19 项发现全部修复闭环 - 设计统一:各站宽度 token(--container + site-container)、classic hero 重设计、 头部换行修复、页面过渡与 View Transitions - 截图功能:api.adx9.com 截图服务接入(ow=800 本地化 webp、cf=1、去重/限流/占位图) - SEO 底座化:canonical/hreflang/sitemap/JSON-LD/robots 全部收进 core,新站自动继承 - 加载体验:五站五形态路由骨架(data-theme 切换、shimmer 微光、延迟淡入)+ 过滤 useTransition 交叉淡入淡出(card-enter 错峰入场) - 构建:experimental.cpus 限流防 PG 连接打满;清理死组件链
76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import glob from "fast-glob";
|
|
|
|
async function main() {
|
|
const blogRoot = path.join(process.cwd(), "src/content/blog");
|
|
const entries = await glob("**/*.mdx", { cwd: blogRoot });
|
|
const manifest = new Map();
|
|
|
|
for (const entry of entries) {
|
|
const segments = entry.split("/");
|
|
|
|
if (segments.length < 2) {
|
|
continue;
|
|
}
|
|
|
|
const [slug, filename] = segments;
|
|
|
|
if (!slug || slug.startsWith("[")) {
|
|
continue;
|
|
}
|
|
|
|
const locale = filename.replace(/\.mdx$/, "");
|
|
|
|
if (!locale) {
|
|
continue;
|
|
}
|
|
|
|
if (!manifest.has(slug)) {
|
|
manifest.set(slug, new Set());
|
|
}
|
|
|
|
manifest.get(slug).add(locale);
|
|
}
|
|
|
|
const sortedManifest = Array.from(manifest.entries()).sort(([a], [b]) =>
|
|
a.localeCompare(b)
|
|
);
|
|
|
|
const lines = [];
|
|
lines.push("// This file is auto-generated by scripts/generate-blog-manifest.mjs");
|
|
lines.push("/// <reference path=\"../types/mdx.d.ts\" />");
|
|
lines.push("// Do not edit manually.\n");
|
|
lines.push("export const blogModuleLoaders = {");
|
|
|
|
for (const [slug, locales] of sortedManifest) {
|
|
lines.push(` "${slug}": {`);
|
|
|
|
const sortedLocales = Array.from(locales).sort((a, b) => a.localeCompare(b));
|
|
|
|
for (const locale of sortedLocales) {
|
|
// 使用 path.posix 确保导入路径始终使用 / (跨平台兼容)
|
|
const importPath = path.posix.join(
|
|
"..",
|
|
"content",
|
|
"blog",
|
|
slug,
|
|
`${locale}.mdx`
|
|
);
|
|
lines.push(` "${locale}": () => import("${importPath}"),`);
|
|
}
|
|
|
|
lines.push(" },");
|
|
}
|
|
|
|
lines.push("} as const;\n");
|
|
|
|
const targetPath = path.join(process.cwd(), "src/lib/blog-manifest.generated.ts");
|
|
fs.writeFileSync(targetPath, lines.join("\n"), "utf-8");
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exitCode = 1;
|
|
});
|