From e53718dc0736466528b0c23198f4962bbcfa41c2 Mon Sep 17 00:00:00 2001 From: 0xBuooy Date: Mon, 18 May 2026 11:51:45 +0800 Subject: [PATCH 1/2] Support local production Wrangler config Add a gitignored wrangler.production.jsonc convention for production-only deployment values so real domains, mailbox addresses, and Access settings do not need to live in the shared config. Document the workflow in the README and add production-specific npm scripts for Wrangler type generation and deployment using the local config file. --- .gitignore | 1 + README.md | 8 ++++++++ package.json | 2 ++ 3 files changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index 978e05fe..ad40059f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ opencode.jsonc skills-lock.json .DS_Store worker-configuration.d.ts +wrangler.production.jsonc diff --git a/README.md b/README.md index e1e2eb72..da645be6 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,20 @@ npm run dev 1. Set your domain in `wrangler.jsonc` 2. Create an R2 bucket named `agentic-inbox`: `wrangler r2 bucket create agentic-inbox` +For production-specific values, keep a local `wrangler.production.jsonc` file. This file is ignored by git so real domains, mailbox addresses, Access values, and other deployment-specific settings are not committed. Use `wrangler.jsonc` as the shared example, copy it locally to `wrangler.production.jsonc`, then set production-only values such as `DOMAINS`, `EMAIL_ADDRESSES`, `POLICY_AUD`, and `TEAM_DOMAIN`. + ### Deploy ```bash npm run deploy ``` +To deploy with the local production config: + +```bash +npm run deploy:production +``` + ## Prerequisites - Cloudflare account with a domain diff --git a/package.json b/package.json index 9d6f0272..0a5114a2 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,9 @@ "scripts": { "build": "react-router build", "cf-typegen": "wrangler types", + "cf-typegen:production": "wrangler types --config wrangler.production.jsonc", "deploy": "npm run build && wrangler deploy", + "deploy:production": "npm run build && wrangler deploy --config wrangler.production.jsonc", "dev": "react-router dev", "preview": "npm run build && vite preview", "typecheck": "npm run cf-typegen && react-router typegen && tsc -b" From b0e8f14cfc7b07115f4d2d18696b0d02ab65bb9d Mon Sep 17 00:00:00 2001 From: 0xBuooy Date: Mon, 18 May 2026 11:58:20 +0800 Subject: [PATCH 2/2] Fix production Wrangler deploy build Build production deployments through the Cloudflare Vite plugin with the local production Wrangler config, so React Router generates the deployable build/server/wrangler.json output. Update deploy:production to deploy the generated build config instead of passing wrangler.production.jsonc directly to Wrangler, which bypassed the Vite build output and failed to resolve the virtual React Router server build module. --- package.json | 3 ++- vite.config.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0a5114a2..670512f7 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,11 @@ }, "scripts": { "build": "react-router build", + "build:production": "CLOUDFLARE_CONFIG_PATH=wrangler.production.jsonc react-router build", "cf-typegen": "wrangler types", "cf-typegen:production": "wrangler types --config wrangler.production.jsonc", "deploy": "npm run build && wrangler deploy", - "deploy:production": "npm run build && wrangler deploy --config wrangler.production.jsonc", + "deploy:production": "npm run build:production && wrangler deploy", "dev": "react-router dev", "preview": "npm run build && vite preview", "typecheck": "npm run cf-typegen && react-router typegen && tsc -b" diff --git a/vite.config.ts b/vite.config.ts index 2c7bfb64..7f616923 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,7 +10,10 @@ import tsconfigPaths from "vite-tsconfig-paths"; export default defineConfig({ plugins: [ - cloudflare({ viteEnvironment: { name: "ssr" } }), + cloudflare({ + configPath: process.env.CLOUDFLARE_CONFIG_PATH, + viteEnvironment: { name: "ssr" }, + }), tailwindcss(), reactRouter(), tsconfigPaths(),