Skip to content

Commit

Permalink
Adapt the blog starter to cloudflare workers
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankboosi authored and vicb committed Oct 12, 2024
1 parent a7da358 commit 5bceecc
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/brave-birds-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@opennextjs/cloudflare": patch
---

example: Add vercel blog starter

Update the examples with vercel blog starter and adapt it to run on cf workers
4 changes: 4 additions & 0 deletions examples/vercel-blog-starter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

#cf workers
.wrangler
.worker-next
4 changes: 4 additions & 0 deletions examples/vercel-blog-starter/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
10 changes: 8 additions & 2 deletions examples/vercel-blog-starter/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "vercel-blog-starter",
"private": true,
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
"start": "next start",
"build:worker": "cloudflare",
"dev:worker": "wrangler dev --port 8773",
"preview:worker": "pnpm build:worker && pnpm dev:worker"
},
"dependencies": {
"classnames": "^2.5.1",
Expand All @@ -16,12 +20,14 @@
"remark-html": "^16.0.1"
},
"devDependencies": {
"@opennextjs/cloudflare": "workspace:*",
"@types/node": "^20.14.8",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.2"
"typescript": "^5.5.2",
"wrangler": "^3.80.4"
}
}
9 changes: 9 additions & 0 deletions examples/vercel-blog-starter/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#:schema node_modules/wrangler/config-schema.json
name = "vercel-blog-starter-on-workers"
main = ".worker-next/index.mjs"

compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]

# Use the new Workers + Assets to host the static frontend files
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
143 changes: 143 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bceecc

Please sign in to comment.