Skip to content

Commit

Permalink
Cloudflare pages integration (#26)
Browse files Browse the repository at this point in the history
* Progress toward integrating more tightly with Cloudflare Pages

* Add favicon and experiment with accessing CF bindings

* Tweaks to fix build

* More adjustments

* Again

* Update some deps

* Explicitly add pnpm as package manager

* Remove beta wrangler.toml config

* Use pnpm in commands

* Remove unnecessary KV access

* Switch to src folder, add direct D1 integration

* Add analytics binding

* Test latency

* More info

* Fix obvious error

* More data

* Remove SonicJS path for posts, add pagination

* Clean up code, add summary field

* Add desc on orderby

* Update page size, upgrade deps
  • Loading branch information
tombakerjr authored Jul 29, 2024
1 parent 4d44c98 commit 015130b
Show file tree
Hide file tree
Showing 36 changed files with 3,786 additions and 259 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"],
"extends": ["next/core-web-vitals", "plugin:next-on-pages/recommended", "plugin:prettier/recommended"],
"plugins": [
"react-compiler",
"unused-imports"
"unused-imports",
"next-on-pages"
],
"rules": {
"react-compiler/react-compiler": "error",
"unused-imports/no-unused-imports-ts": "warn"
"unused-imports/no-unused-imports-ts": "warn",
"next-on-pages/no-unsupported-configs": "warn"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts


.wrangler
31 changes: 0 additions & 31 deletions app/blog/[slug]/page.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions app/blog/page.tsx

This file was deleted.

7 changes: 7 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Generated by Wrangler on Fri Jun 28 2024 16:57:45 GMT-0400 (Eastern Daylight Time)
// by running `wrangler types --env-interface CloudflareEnv env.d.ts`

interface CloudflareEnv {
KVDATA: KVNamespace;
D1DATA: D1Database;
}
8 changes: 0 additions & 8 deletions next.config.js

This file was deleted.

15 changes: 15 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('next').NextConfig} */

import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";

const nextConfig = {
experimental: {
reactCompiler: true,
},
};

export default nextConfig;

if (process.env.NODE_ENV === "development") {
await setupDevPlatform();
}
35 changes: 23 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,43 @@
"name": "tombaker-blog-new",
"version": "0.1.0",
"private": true,
"packageManager": "pnpm@9.6.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"pages:build": "pnpm dlx @cloudflare/next-on-pages",
"preview": "pnpm run pages:build && wrangler pages dev .vercel/output/static",
"preview:remote": "pnpm run pages:build && wrangler pages dev --remote .vercel/output/static",
"build-cf-types": "wrangler types --env-interface CloudflareEnv env.d.ts"
},
"dependencies": {
"@types/node": "^20.14.2",
"@types/node": "^20.14.13",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"babel-plugin-react-compiler": "0.0.0-experimental-938cd9a-20240601",
"babel-plugin-react-compiler": "0.0.0-experimental-696af53-20240625",
"drizzle-orm": "^0.32.1",
"eslint": "~8.57.0",
"eslint-config-next": "15.0.0-rc.0",
"next": "15.0.0-rc.0",
"react": "19.0.0-rc-34d0c5e357-20240607",
"react-dom": "19.0.0-rc-34d0c5e357-20240607",
"typescript": "^5.4.5"
"react": "19.0.0-rc-58af67a8f8-20240628",
"react-dom": "19.0.0-rc-58af67a8f8-20240628",
"typescript": "^5.5.4"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.12.1",
"@cloudflare/workers-types": "^4.20240725.0",
"@typescript-eslint/typescript-estree": "^7.17.0",
"autoprefixer": "^10.4.19",
"drizzle-kit": "^0.23.0",
"eslint-config-next": "15.0.0-rc.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-compiler": "0.0.0-experimental-51a85ea-20240601",
"eslint-plugin-next-on-pages": "^1.12.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-compiler": "0.0.0-experimental-9ed098e-20240725",
"eslint-plugin-unused-imports": "~3.2.0",
"postcss": "^8.4.38",
"prettier": "^3.3.2",
"tailwindcss": "^3.4.4"
"postcss": "^8.4.40",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.7"
}
}
Loading

0 comments on commit 015130b

Please sign in to comment.