Skip to content

Commit

Permalink
style(astro): Merge all config object into one (#59)
Browse files Browse the repository at this point in the history
Also, enable Dev Tool not on a test.
  • Loading branch information
5ouma authored Nov 22, 2024
1 parent 70d85d4 commit d06d6df
Showing 1 changed file with 31 additions and 35 deletions.
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" },
});

0 comments on commit d06d6df

Please sign in to comment.