mirror of
https://github.com/beilunyang/moemail.git
synced 2026-09-05 15:26:38 +08:00
Merge pull request #43 from sdrpsps/fix/deploy-pages-name
fix: Deploy script PROJECT_NAME is invalid
This commit is contained in:
@@ -16,7 +16,6 @@ const PROJECT_NAME = process.env.PROJECT_NAME || "moemail";
|
|||||||
const DATABASE_NAME = process.env.DATABASE_NAME || "moemail-db";
|
const DATABASE_NAME = process.env.DATABASE_NAME || "moemail-db";
|
||||||
const KV_NAMESPACE_NAME = process.env.KV_NAMESPACE_NAME || "moemail-kv";
|
const KV_NAMESPACE_NAME = process.env.KV_NAMESPACE_NAME || "moemail-kv";
|
||||||
const CUSTOM_DOMAIN = process.env.CUSTOM_DOMAIN;
|
const CUSTOM_DOMAIN = process.env.CUSTOM_DOMAIN;
|
||||||
|
|
||||||
const KV_NAMESPACE_ID = process.env.KV_NAMESPACE_ID;
|
const KV_NAMESPACE_ID = process.env.KV_NAMESPACE_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +51,11 @@ const setupConfigFile = (examplePath: string, targetPath: string) => {
|
|||||||
const configContent = readFileSync(examplePath, "utf-8");
|
const configContent = readFileSync(examplePath, "utf-8");
|
||||||
const json = JSON.parse(configContent);
|
const json = JSON.parse(configContent);
|
||||||
|
|
||||||
|
// 写入 pages 项目名称
|
||||||
|
if (targetPath.split("/").at(-1) === "wrangler.json") {
|
||||||
|
json.name = PROJECT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
// 处理数据库配置
|
// 处理数据库配置
|
||||||
if (json.d1_databases && json.d1_databases.length > 0) {
|
if (json.d1_databases && json.d1_databases.length > 0) {
|
||||||
json.d1_databases[0].database_name = DATABASE_NAME;
|
json.d1_databases[0].database_name = DATABASE_NAME;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "node_modules/wrangler/config-schema.json",
|
"$schema": "node_modules/wrangler/config-schema.json",
|
||||||
"name": "moemail",
|
"name": "${PROJECT_NAME}",
|
||||||
"compatibility_date": "2024-03-20",
|
"compatibility_date": "2024-03-20",
|
||||||
"compatibility_flags": ["nodejs_compat"],
|
"compatibility_flags": ["nodejs_compat"],
|
||||||
"pages_build_output_dir": ".vercel/output/static",
|
"pages_build_output_dir": ".vercel/output/static",
|
||||||
|
|||||||
Reference in New Issue
Block a user