Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge all Astro config object into one #59

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 31 additions & 35 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
import sitemap from "@astrojs/sitemap";
import { codecovVitePlugin } from "@codecov/vite-plugin";
import AstroPWA from "@vite-pwa/astro";
import type { AstroIntegration } from "astro";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import astrobook from "astrobook";

import meta from "./src/libs/meta.ts";

const integrations: AstroIntegration[] = [
sitemap(),
AstroPWA({
manifest: {
name: meta.name,
short_name: meta.name,
description: meta.description,
icons: [{ src: meta.icon }],
orientation: "landscape",
display: "fullscreen",
theme_color: "#f4f4f4",
},
workbox: {
maximumFileSizeToCacheInBytes: 1024 * 1024 * 2.2,
globPatterns: ["**/*.{html,js,woff2}"],
navigateFallback: "/",
runtimeCaching: [
{
handler: "NetworkFirst",
options: { cacheName: "icon" },
urlPattern: () => true,
},
],
},
}),
icon(),
];

if (process.env.ASTROBOOK) {
integrations.push(astrobook({ directory: "src/components" }));
}

export default defineConfig({
site: meta.card,
integrations,
integrations: [
sitemap(),
icon(),
AstroPWA({
manifest: {
name: meta.name,
short_name: meta.name,
description: meta.description,
icons: [{ src: meta.icon }],
orientation: "landscape",
display: "fullscreen",
theme_color: "#f4f4f4",
},
workbox: {
maximumFileSizeToCacheInBytes: 1024 * 1024 * 2.2,
globPatterns: ["**/*.{html,js,woff2}"],
navigateFallback: "/",
runtimeCaching: [
{
handler: "NetworkFirst",
options: { cacheName: "icon" },
urlPattern: () => true,
},
],
},
}),
...(process.env.ASTROBOOK
? [astrobook({ directory: "src/components" })]
: []),
],
vite: {
plugins: [
codecovVitePlugin({
Expand All @@ -52,5 +48,5 @@ export default defineConfig({
}),
],
},
devToolbar: { enabled: false },
devToolbar: { enabled: process.env.NODE_ENV !== "test" },
});