Skip to content

Commit 0028c36

Browse files
Add Cloudflare Workers configuration
1 parent f28cb1e commit 0028c36

6 files changed

Lines changed: 242 additions & 37 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ pnpm-debug.log*
2727
.eslintcache
2828

2929
.wrangler/
30+
31+
.dev.vars*
32+
!.dev.vars.example
33+
!.env.example

astro.config.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import icon from "astro-icon";
66
import sitemap from "@astrojs/sitemap";
77
import mdx from "@astrojs/mdx";
88

9+
import cloudflare from "@astrojs/cloudflare";
10+
911
const GIT_COMMIT_HASH = (process.env.GITHUB_SHA || "").trim().slice(0, 7) || execSync("git rev-parse --short HEAD").toString().trim();
1012
const SITE_URL = process.env.SITE_URL || "https://hyperzonelogin.pages.dev";
1113

@@ -43,4 +45,6 @@ export default defineConfig({
4345
sitemap(),
4446
mdx(),
4547
],
46-
});
48+
49+
adapter: cloudflare(),
50+
});

bun.lock

Lines changed: 198 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
"scripts": {
66
"dev": "astro dev",
77
"build": "astro build",
8-
"preview": "astro preview",
8+
"preview": "bun run build && wrangler dev",
99
"astro": "astro",
1010
"format": "prettier --write --list-different .",
1111
"lint:eslint": "eslint . --cache",
1212
"lint:prettier": "prettier --check .",
1313
"check:types": "astro sync && tsgo --noEmit",
1414
"lint": "bun run lint:eslint && bun run lint:prettier",
1515
"check": "bun run check:types",
16-
"check:all": "bun run check && bun run lint"
16+
"check:all": "bun run check && bun run lint",
17+
"generate-types": "wrangler types",
18+
"deploy": "bun run build && wrangler deploy"
1719
},
1820
"dependencies": {
21+
"@astrojs/cloudflare": "^13.1.10",
1922
"@astrojs/rss": "4.0.18",
2023
"@astrojs/sitemap": "3.7.2",
2124
"@astrojs/svelte": "8.0.4",
@@ -45,12 +48,16 @@
4548
"prettier-plugin-astro": "0.14.1",
4649
"prettier-plugin-svelte": "3.5.1",
4750
"prettier-plugin-tailwindcss": "0.7.2",
48-
"svelte-eslint-parser": "1.6.0"
51+
"svelte-eslint-parser": "1.6.0",
52+
"wrangler": "^4.84.1"
4953
},
5054
"devEngines": {
5155
"runtime": {
5256
"name": "node",
5357
"version": ">=22.x"
5458
}
59+
},
60+
"overrides": {
61+
"vite": "^7"
5562
}
5663
}

tsconfig.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
22
"extends": "astro/tsconfigs/strict",
3-
"include": [".astro/types.d.ts", "**/*"],
4-
"exclude": ["dist"],
3+
"include": [
4+
".astro/types.d.ts",
5+
"**/*",
6+
"./worker-configuration.d.ts"
7+
],
8+
"exclude": [
9+
"dist"
10+
],
511
"compilerOptions": {
612
"paths": {
7-
"@/*": ["./src/*"]
13+
"@/*": [
14+
"./src/*"
15+
]
816
},
917
"strictNullChecks": true,
1018
"allowJs": true
1119
}
12-
}
20+
}

wrangler.jsonc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compatibility_date": "2026-04-22",
3+
"compatibility_flags": ["global_fetch_strictly_public"],
4+
"name": "paper-astro",
5+
"main": "@astrojs/cloudflare/entrypoints/server",
6+
"assets": {
7+
"directory": "./dist",
8+
"binding": "ASSETS"
9+
},
10+
"observability": {
11+
"enabled": true
12+
}
13+
}

0 commit comments

Comments
 (0)