From 8e8291c325914fedc31bc33a895ec9beed06224e Mon Sep 17 00:00:00 2001 From: javayhu Date: Sun, 8 Jun 2025 21:18:42 +0800 Subject: [PATCH] cf: update configs by the opennextjs docs --- .gitignore | 6 ++++++ messages/en.json | 2 +- package.json | 2 +- pnpm-lock.yaml | 6 +++--- public/_headers | 2 ++ wrangler.jsonc | 9 ++++++++- 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 public/_headers diff --git a/.gitignore b/.gitignore index 796dc79..b7b7f7f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,9 @@ next-env.d.ts .content-collections # OpenNext build output .open-next + +# wrangler files +.wrangler +.dev.vars +.dev.vars* +!.dev.vars.example diff --git a/messages/en.json b/messages/en.json index 12651db..5d6ba4f 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1,6 +1,6 @@ { "Metadata": { - "name": "MkSaaS Demo on Cloudflare", + "name": "MkSaaS Cloudflare", "title": "MkSaaS - The Best AI SaaS Boilerplate", "description": "MkSaaS is the best AI SaaS boilerplate. Make AI SaaS in days, simply and effortlessly" }, diff --git a/package.json b/package.json index 6245393..4f19ea8 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@fumadocs/content-collections": "^1.1.8", "@hookform/resolvers": "^4.1.0", "@next/third-parties": "^15.3.0", + "@opennextjs/cloudflare": "^1.2.1", "@openpanel/nextjs": "^1.0.7", "@orama/orama": "^3.1.4", "@orama/tokenizers": "^3.1.4", @@ -136,7 +137,6 @@ "devDependencies": { "@biomejs/biome": "1.9.4", "@content-collections/cli": "^0.1.6", - "@opennextjs/cloudflare": "^1.2.1", "@tailwindcss/postcss": "^4.0.14", "@types/mdx": "^2.0.13", "@types/node": "^20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c962e2a..ab81a75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,6 +50,9 @@ importers: '@next/third-parties': specifier: ^15.3.0 version: 15.3.0(next@15.2.1(@babel/core@7.24.5)(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) + '@opennextjs/cloudflare': + specifier: ^1.2.1 + version: 1.2.1(wrangler@4.14.1) '@openpanel/nextjs': specifier: ^1.0.7 version: 1.0.7(next@15.2.1(@babel/core@7.24.5)(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -345,9 +348,6 @@ importers: '@content-collections/cli': specifier: ^0.1.6 version: 0.1.6(@content-collections/core@0.8.0(typescript@5.7.3)) - '@opennextjs/cloudflare': - specifier: ^1.2.1 - version: 1.2.1(wrangler@4.14.1) '@tailwindcss/postcss': specifier: ^4.0.14 version: 4.0.14 diff --git a/public/_headers b/public/_headers new file mode 100644 index 0000000..e6320ab --- /dev/null +++ b/public/_headers @@ -0,0 +1,2 @@ +/_next/static/* + Cache-Control: public,max-age=31536000,immutable \ No newline at end of file diff --git a/wrangler.jsonc b/wrangler.jsonc index ce59919..3ca7666 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -8,8 +8,15 @@ "name": "mksaas-template", "compatibility_date": "2024-12-30", "compatibility_flags": [ + // Enable Node.js API + // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag "nodejs_compat", - "nodejs_compat_populate_process_env" + // Enable auto-populating process.env + // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#enable-auto-populating-processenv + "nodejs_compat_populate_process_env", + // Allow to fetch URLs in your app + // see https://developers.cloudflare.com/workers/configuration/compatibility-flags/#global-fetch-strictly-public + "global_fetch_strictly_public" ], // Minification helps to keep the Worker bundle size down and improve start up time. "minify": true,