Skip to content

Commit 732ecab

Browse files
Add Cloudflare Workers configuration
1 parent 21bfc71 commit 732ecab

6 files changed

Lines changed: 1304 additions & 25 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ pnpm-debug.log*
1919

2020
# macOS-specific files
2121
.DS_Store
22+
23+
# wrangler files
24+
.wrangler
25+
.dev.vars*
26+
!.dev.vars.example
27+
!.env.example

astro.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ import { defineConfig } from "astro/config";
33
import tailwind from "@astrojs/tailwind";
44
import vitePluginStats from "./scripts/vite-plugin-stats.js";
55

6+
import cloudflare from "@astrojs/cloudflare";
7+
68
// https://astro.build/config
79
export default defineConfig({
810
site: process.env.CONTEXT !== 'production' && process.env.DEPLOY_PRIME_URL || 'https://issues.astro.build/',
911
integrations: [tailwind({ applyBaseStyles: false })],
12+
1013
vite: {
1114
plugins: [vitePluginStats()],
1215
},
13-
});
16+
17+
adapter: cloudflare()
18+
});

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
"dev": "astro dev",
77
"start": "astro dev",
88
"build": "astro build",
9-
"preview": "astro preview",
9+
"preview": "pnpm run build && wrangler dev",
1010
"astro": "astro",
11-
"collect-stats": "tsx ./scripts/get-stats"
11+
"collect-stats": "tsx ./scripts/get-stats",
12+
"deploy": "pnpm run build && wrangler deploy",
13+
"cf-typegen": "wrangler types"
1214
},
1315
"dependencies": {
16+
"@astrojs/cloudflare": "12",
1417
"@astrojs/site-kit": "github:withastro/site-kit",
1518
"@astrojs/tailwind": "^5.1.3",
1619
"@fontsource-variable/inter": "^5.1.0",
@@ -26,7 +29,8 @@
2629
"tsx": "^4.19.2"
2730
},
2831
"devDependencies": {
29-
"vite": "^6.3.5"
32+
"vite": "^6.3.5",
33+
"wrangler": "^4.110.0"
3034
},
3135
"packageManager": "pnpm@8.6.12"
3236
}

0 commit comments

Comments
 (0)