- 原生 Next.js App Router + 严格 TypeScript 实现花魁短剧 PC/H5 页面,按 src/features/{catalog,content,playback} 组织,保留完整 SEO(metadata、JSON-LD、canonical、robots、llms、sitemap、IndexNow)。
- 主域名通过 SITE_URL=https://huakuidj.com 强制覆盖后端 foreverUrlAddr(config/*.env、src/server/config.ts、src/server/seo/shared.ts、src/server/services/shared.ts),支持邮箱改为 support@huakuidj.com。
- 移除登录与账户体系:删除 /account 全部页面、登录/注册/充值弹窗、收藏点赞、评论、金币解锁及对应 BFF 接口;旧账户地址 GET/HEAD 统一 301 到首页(src/lib/routes.ts REMOVED_ACCOUNT_PATHS),保留游客会话、反馈、图片上传、观看上报与搜索联想。
- 播放页:评论位改为同类推荐 + 热播榜单,锁定集改为 App 观看遮罩与底部弹层,新增简介标签、分集图例与独立视觉皮肤(src/features/playback、src/styles/pages/playback.css)。
- 卡片:短剧/视频卡状态与时长移至信息行胶囊标签,封面角标移至左上角(src/components/catalog/Cards.tsx、src/styles/foundations/base.css)。
- 同步更新单元测试、浏览器冒烟脚本、路由清单与 README。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { readFileSync, existsSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { spawn } from "node:child_process";
|
|
import { parse } from "dotenv";
|
|
|
|
const [environment = "development", command = "dev", ...args] =
|
|
process.argv.slice(2);
|
|
if (
|
|
!["development", "test", "production"].includes(environment) ||
|
|
!["dev", "build", "start"].includes(command)
|
|
) {
|
|
throw new Error(
|
|
"Usage: tsx scripts/next-env.ts development|test|production dev|build|start",
|
|
);
|
|
}
|
|
const config = (file: string) =>
|
|
existsSync(file) ? parse(readFileSync(file)) : {};
|
|
const childEnv: NodeJS.ProcessEnv = {
|
|
...config(resolve(`config/${environment}.env`)),
|
|
...config(resolve(`config/${environment}.local.env`)),
|
|
...process.env,
|
|
APP_ENV: environment,
|
|
NODE_ENV: command === "dev" ? "development" : "production",
|
|
};
|
|
if (command !== "build" && !childEnv.UPSTREAM_API_URL?.trim()) {
|
|
throw new Error(
|
|
`UPSTREAM_API_URL is required for ${environment}. Set config/${environment}.local.env or the process environment.`,
|
|
);
|
|
}
|
|
// Turbopack 16.4 can repeatedly restart the root runtime chunk on this site's
|
|
// dynamic document routes. Keep stable development HMR and allow explicit opt-in.
|
|
if (command === "dev" || command === "build") await import("./build-pwa");
|
|
const devBundler =
|
|
command === "dev" &&
|
|
!args.some((arg) => ["--webpack", "--turbopack", "--turbo"].includes(arg))
|
|
? [childEnv.NEXT_DEV_BUNDLER === "turbopack" ? "--turbopack" : "--webpack"]
|
|
: [];
|
|
const child = spawn(
|
|
process.execPath,
|
|
[
|
|
resolve("node_modules/next/dist/bin/next"),
|
|
command,
|
|
...devBundler,
|
|
...(command === "build" ? [] : ["--port", childEnv.PORT || "25121"]),
|
|
...args,
|
|
],
|
|
{ stdio: "inherit", env: childEnv },
|
|
);
|
|
for (const signal of ["SIGINT", "SIGTERM"] as const)
|
|
process.on(signal, () => child.kill(signal));
|
|
child.on("exit", (code) => process.exit(code ?? 1));
|