Add Cloudflare Pages support

This commit is contained in:
Nikita Karamov 2023-03-18 02:43:57 +01:00
parent a194925ce1
commit a511f518af
No known key found for this signature in database
GPG Key ID: 41D6F71EE78E77CD
3 changed files with 17 additions and 0 deletions

View File

@ -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({

View File

@ -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",

View File

@ -1,6 +1,7 @@
lockfileVersion: 5.4
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