fix: Update deploy script for support custom project name

This commit is contained in:
beilunyang
2025-04-06 20:47:57 +08:00
parent eb88cbcb31
commit 0b9f457e52
2 changed files with 18 additions and 4 deletions

View File

@@ -51,9 +51,23 @@ const setupConfigFile = (examplePath: string, targetPath: string) => {
const configContent = readFileSync(examplePath, "utf-8");
const json = JSON.parse(configContent);
// 写入 pages 项目名称
if (targetPath.split("/").at(-1) === "wrangler.json") {
json.name = PROJECT_NAME;
// 处理自定义项目名称
if (PROJECT_NAME !== "moemail") {
const wranglerFileName = targetPath.split("/").at(-1);
switch (wranglerFileName) {
case "wrangler.json":
json.name = PROJECT_NAME;
break;
case "wrangler.email.json":
json.name = `${PROJECT_NAME}-email-receiver-worker`;
break;
case "wrangler.cleanup.json":
json.name = `${PROJECT_NAME}-cleanup-worker`;
break;
default:
break;
}
}
// 处理数据库配置

View File

@@ -1,6 +1,6 @@
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "${PROJECT_NAME}",
"name": "moemail",
"compatibility_date": "2024-03-20",
"compatibility_flags": ["nodejs_compat"],
"pages_build_output_dir": ".vercel/output/static",