Skip to content

Commit da22d73

Browse files
authored
Merge pull request #28 from oeasy1412/cloudflare/workers-autoconfig
Add Cloudflare Workers configuration
2 parents df1527f + 354ed9d commit da22d73

7 files changed

Lines changed: 1439 additions & 99 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ yarn.lock
2929
# obsidian
3030
.obsidian/
3131
.smtcmp_json_db
32+
33+
# wrangler files
34+
.wrangler
35+
.dev.vars*
36+
!.dev.vars.example
37+
!.env.example

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.alinche.dpdns.org/",
30-
base: "/",
31-
trailingSlash: "always",
32-
integrations: [
31+
site: "https://blog.alinche.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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
"start": "astro dev",
88
"check": "astro check",
99
"build": "astro build && pagefind --site dist",
10-
"preview": "astro preview",
10+
"preview": "pnpm run build && wrangler dev",
1111
"astro": "astro",
1212
"type-check": "tsc --noEmit --isolatedDeclarations",
1313
"new-post": "node scripts/new-post.js",
1414
"format": "biome format --write ./src",
1515
"lint": "biome check --write ./src",
16-
"preinstall": "npx only-allow pnpm"
16+
"preinstall": "npx only-allow pnpm",
17+
"deploy": "pnpm run build && wrangler deploy",
18+
"cf-typegen": "wrangler types"
1719
},
1820
"dependencies": {
1921
"@astrojs/check": "^0.9.4",
22+
"@astrojs/cloudflare": "12",
2023
"@astrojs/rss": "^4.0.12",
2124
"@astrojs/sitemap": "^3.4.1",
2225
"@astrojs/svelte": "7.1.0",
@@ -70,7 +73,8 @@
7073
"@types/mdast": "^4.0.4",
7174
"@types/sanitize-html": "^2.16.0",
7275
"postcss-import": "^16.1.1",
73-
"postcss-nesting": "^13.0.2"
76+
"postcss-nesting": "^13.0.2",
77+
"wrangler": "^4.107.0"
7478
},
7579
"packageManager": "pnpm@9.14.4"
7680
}

0 commit comments

Comments
 (0)