Fix: Cloudflare Deploy

swadhinbiswas committed 9 months ago
8751a22
1 parent bdf41c6
commit 8751a22
3 files changed
+27 -1
Showing 3 changed files+27-1
▼package.json
+2-1
7
7
"start": "astro dev",
8
8
"build": "astro build",
9
9
"preview": "astro preview",
10
+ "deploy": "wrangler deploy",
10
11
"astro": "astro"
11
12
},
12
13
"dependencies": {
14
15
"astro": "^5.6.1",
15
16
"sharp": "^0.34.2"
16
17
}
17
-}
18
+}
18
19
▼src/worker.ts
+10-0
1
+export interface Env {
2
+ ASSETS: Fetcher;
3
+}
4
+
5
+export default {
6
+ async fetch(request: Request, env: Env): Promise<Response> {
7
+ // Delegate all requests to the static asset handler.
8
+ return env.ASSETS.fetch(request);
9
+ },
10
+};
0
11
▼wrangler.jsonc
+15-0
1
+{
2
+ // Cloudflare Workers config for deploying this Astro build as static assets.
3
+ // This makes `npx wrangler deploy` work without extra CLI arguments.
4
+ "name": "opencodehub-docs",
5
+ "compatibility_date": "2026-01-22",
6
+
7
+ // Minimal worker that forwards requests to the uploaded static assets.
8
+ "main": "src/worker.ts",
9
+
10
+ // Upload `dist/` as Workers static assets.
11
+ "assets": {
12
+ "directory": "./dist",
13
+ "binding": "ASSETS",
14
+ },
15
+}
0
16