From 835e75519b9eefcb80dfad48523c86fb7f4fa2f3 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Sat, 18 Mar 2023 02:43:57 +0100 Subject: [PATCH] Add Cloudflare Pages support --- astro.config.ts | 4 ++++ package.json | 1 + pnpm-lock.yaml | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/astro.config.ts b/astro.config.ts index 66f6148..95af1d1 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from "astro/config"; +import cloudflare from "@astrojs/cloudflare"; import netlify from "@astrojs/netlify/functions"; import node from "@astrojs/node"; import vercel from "@astrojs/vercel/serverless"; @@ -11,6 +12,9 @@ if (process.env.VERCEL) { } else if (process.env.NETLIFY) { console.debug("Using Netlify adapter"); astroAdapter = netlify(); +} else if (process.env.CF_PAGES) { + console.debug("Using Cloudflare adapter"); + astroAdapter = cloudflare(); } else { console.debug("Using Node.js adapter"); astroAdapter = node({ diff --git a/package.json b/package.json index b458b73..e960923 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "browserslist": "cover 95%, last 2 versions, Firefox ESR, not dead", "dependencies": { + "@astrojs/cloudflare": "^6.2.1", "@astrojs/netlify": "^2.2.0", "@astrojs/node": "^5.1.0", "@astrojs/vercel": "^3.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 110f58d..15d9b42 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,7 @@ lockfileVersion: '6.0' specifiers: + '@astrojs/cloudflare': ^6.2.1 '@astrojs/netlify': ^2.2.0 '@astrojs/node': ^5.1.0 '@astrojs/vercel': ^3.2.1 @@ -25,6 +26,7 @@ specifiers: typescript: ^5.0.2 dependencies: + '@astrojs/cloudflare': 6.2.1_astro@2.1.3 '@astrojs/netlify': 2.2.0_astro@2.1.3 '@astrojs/node': 5.1.0_astro@2.1.3 '@astrojs/vercel': 3.2.1_astro@2.1.3 @@ -60,6 +62,16 @@ packages: '@jridgewell/trace-mapping': 0.3.17 dev: false + /@astrojs/cloudflare/6.2.1_astro@2.1.3: + resolution: {integrity: sha512-yIk6D0PKVOEyUR5px/oqMbkgDFoMPnwv+i9CzFY6r3FnNy+phhyuCxRkBIJumbTVgBo0j8j0fFmZ9ioGvCFXxg==} + peerDependencies: + astro: ^2.1.3 + dependencies: + astro: 2.1.3_sass@1.59.3+sharp@0.31.3 + esbuild: 0.15.18 + tiny-glob: 0.2.9 + dev: false + /@astrojs/compiler/0.31.4: resolution: {integrity: sha512-6bBFeDTtPOn4jZaiD3p0f05MEGQL9pw2Zbfj546oFETNmjJFWO3nzHz6/m+P53calknCvyVzZ5YhoBLIvzn5iw==} dev: false