Skip to content

Commit 581e7ae

Browse files
Add Cloudflare Workers configuration
1 parent 1e4bdf9 commit 581e7ae

6 files changed

Lines changed: 116 additions & 73 deletions

File tree

astro.config.mjs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import expressiveCode from "astro-expressive-code";
88
import icon from "astro-icon";
99
import { defineConfig } from "astro/config";
1010
import rehypeAutolinkHeadings from "rehype-autolink-headings";
11-
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
11+
import rehypeComponents from "rehype-components";/* Render the custom directive content */
1212
import rehypeKatex from "rehype-katex";
1313
import rehypeSlug from "rehype-slug";
14-
import remarkDirective from "remark-directive"; /* Handle directives */
14+
import remarkDirective from "remark-directive";/* Handle directives */
1515
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
1616
import remarkMath from "remark-math";
1717
import remarkSectionize from "remark-sectionize";
@@ -24,12 +24,15 @@ import { remarkExcerpt } from "./src/plugins/remark-excerpt.js";
2424
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
2525
import { pluginCustomCopyButton } from "./src/plugins/expressive-code/custom-copy-button.js";
2626

27+
import cloudflare from "@astrojs/cloudflare";
28+
2729
// https://astro.build/config
2830
export default defineConfig({
29-
site: "https://blog.alinche666.dpdns.org/",
30-
base: "/",
31-
trailingSlash: "always",
32-
integrations: [
31+
site: "https://blog.alinche666.dpdns.org/",
32+
base: "/",
33+
trailingSlash: "always",
34+
35+
integrations: [
3336
tailwind({
3437
nesting: true,
3538
}),
@@ -102,7 +105,8 @@ export default defineConfig({
102105
svelte(),
103106
sitemap(),
104107
],
105-
markdown: {
108+
109+
markdown: {
106110
remarkPlugins: [
107111
remarkMath,
108112
remarkReadingTime,
@@ -153,7 +157,8 @@ export default defineConfig({
153157
],
154158
],
155159
},
156-
vite: {
160+
161+
vite: {
157162
build: {
158163
rollupOptions: {
159164
onwarn(warning, warn) {
@@ -169,4 +174,6 @@ export default defineConfig({
169174
},
170175
},
171176
},
172-
});
177+
178+
adapter: cloudflare()
179+
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"dependencies": {
2121
"@astrojs/check": "^0.9.9",
22-
"@astrojs/cloudflare": "12",
22+
"@astrojs/cloudflare": "^12.6.13",
2323
"@astrojs/rss": "^4.0.19",
2424
"@astrojs/sitemap": "^3.7.3",
2525
"@astrojs/svelte": "7.2.5",
@@ -74,7 +74,7 @@
7474
"@types/sanitize-html": "^2.16.1",
7575
"postcss-import": "^16.1.1",
7676
"postcss-nesting": "^13.0.2",
77-
"wrangler": "^4.107.0"
77+
"wrangler": "^4.110.0"
7878
},
7979
"packageManager": "pnpm@9.14.4"
8080
}

pnpm-lock.yaml

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

public/.assetsignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_worker.js
2+
_routes.json

tsconfig.json

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
{
2-
"extends": "astro/tsconfigs/strict",
3-
"compilerOptions": {
4-
"baseUrl": ".",
5-
"strictNullChecks": true,
6-
"allowJs": false,
7-
"declaration": true,
8-
"plugins": [
9-
{
10-
"name": "@astrojs/ts-plugin"
11-
}
12-
],
13-
"paths": {
14-
"@components/*": ["src/components/*"],
15-
"@assets/*": ["src/assets/*"],
16-
"@constants/*": ["src/constants/*"],
17-
"@utils/*": ["src/utils/*"],
18-
"@i18n/*": ["src/i18n/*"],
19-
"@layouts/*": ["src/layouts/*"],
20-
"@/*": ["src/*"]
21-
}
22-
},
23-
"include": ["src/**/*"]
24-
}
2+
"extends": "astro/tsconfigs/strict",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"strictNullChecks": true,
6+
"allowJs": false,
7+
"declaration": true,
8+
"plugins": [
9+
{
10+
"name": "@astrojs/ts-plugin"
11+
}
12+
],
13+
"paths": {
14+
"@components/*": [
15+
"src/components/*"
16+
],
17+
"@assets/*": [
18+
"src/assets/*"
19+
],
20+
"@constants/*": [
21+
"src/constants/*"
22+
],
23+
"@utils/*": [
24+
"src/utils/*"
25+
],
26+
"@i18n/*": [
27+
"src/i18n/*"
28+
],
29+
"@layouts/*": [
30+
"src/layouts/*"
31+
],
32+
"@/*": [
33+
"src/*"
34+
]
35+
}
36+
},
37+
"include": [
38+
"src/**/*",
39+
"./worker-configuration.d.ts"
40+
]
41+
}

wrangler.jsonc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "node_modules/wrangler/config-schema.json",
3+
"name": "blog",
4+
"compatibility_date": "2026-07-10",
5+
"observability": {
6+
"enabled": true
7+
},
8+
"main": "dist/_worker.js/index.js",
9+
"compatibility_flags": [
10+
"global_fetch_strictly_public",
11+
"nodejs_compat"
12+
],
13+
"assets": {
14+
"binding": "ASSETS",
15+
"directory": "dist"
16+
}
17+
}

0 commit comments

Comments
 (0)