From 4ee55fe77cc1226c20ef74b2604cf0bdb9665045 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Wed, 30 Aug 2023 12:19:28 +0200 Subject: [PATCH] Simplify Astro config --- astro.config.ts | 30 ++++++++++++++++++------------ package.json | 4 ++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index 6a1e796..c126077 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -8,36 +8,31 @@ import netlify from "@astrojs/netlify"; import node from "@astrojs/node"; import vercel from "@astrojs/vercel/serverless"; -let configMixin = {}; +let adapterConfig = {}; if (process.env.VERCEL) { console.info("Using Vercel (serverless) adapter..."); - configMixin = { - output: "server", + adapterConfig = { adapter: vercel(), }; } else if (process.env.CF_PAGES) { console.info("Using Cloudflare adapter..."); - configMixin = { - output: "server", + adapterConfig = { adapter: cloudflare(), }; } else if (process.env.NETLIFY) { console.info("Using Netlify (Functions) adapter..."); - configMixin = { - output: "server", + adapterConfig = { adapter: netlify(), }; } else if (process.argv.includes("--s2f-use-deno")) { console.info("Using Deno adapter..."); - configMixin = { - output: "server", + adapterConfig = { adapter: deno(), }; } else { console.info("Using Node.js adapter..."); console.info("Run with '--s2f-use-deno' flag to use Deno"); - configMixin = { - output: "server", + adapterConfig = { adapter: node({ mode: "standalone", }), @@ -46,7 +41,18 @@ if (process.env.VERCEL) { export default defineConfig({ site: "https://s2f.kytta.dev", - ...configMixin, + redirects: { + "/api/toot": { + destination: "/api/share", + status: 308, + }, + }, + + compressHTML: true, + + output: "server", + ...adapterConfig, + vite: { plugins: [lightningcss()], }, diff --git a/package.json b/package.json index 171c20f..33dba30 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "private": true, "type": "module", "scripts": { - "dev": "astro dev --host 127.0.0.1", - "start": "astro dev --host 127.0.0.1", + "dev": "astro dev", + "start": "astro dev", "build": "astro build", "build:icons": "bash ./script/build-icons", "preview": "astro preview",