-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.mjs
112 lines (108 loc) · 2.98 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { astroI18nConfigPaths, defaultLocale, localeKeys } from "./i18n.config";
import paraglide from "@inlang/paraglide-astro";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import pagefind from "astro-pagefind";
import { defineConfig, envField } from "astro/config";
import { loadEnv } from "vite";
import iconConfig from "./icons.config";
import node from "@astrojs/node";
const { NODE_ENV } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
const PORT = 4321;
const DEV_ENV = NODE_ENV !== "production";
const SITE_URL = DEV_ENV ? `http://localhost:${PORT}` : "https://daliborhon.dev";
console.log(`>> Using environment: '${NODE_ENV}'`);
console.log(`>> Using SITE_URL: '${SITE_URL}'`);
console.log(`>> Using PORT: '${PORT}'`);
const envVars = {
OA_GITHUB_CLIENT_ID: envField.string({ context: "server", access: "secret", optional: false }),
OA_GITHUB_CLIENT_SECRET: envField.string({ context: "server", access: "secret", optional: false }),
OA_ALLOWED_DOMAINS: envField.string({ context: "server", access: "secret", optional: true }),
GITHUB_API_AUTH_TOKEN: envField.string({ context: "server", access: "secret", optional: false }),
HCAPTCHA_KEY: envField.string({ context: "client", access: "public", default: "50b2fe65-b00b-4b9e-ad62-3ba471098be2" }),
CONTACT_FORM_ACCESS_KEY: envField.string({ context: "server", access: "public", default: "7d81d4b3-a54e-4341-9544-2553a5aa4daf" }),
};
// https://astro.build/config
export default defineConfig({
site: SITE_URL,
output: "hybrid",
build: {
format: "directory",
},
adapter: node({
mode: "standalone",
}),
prefetch: {
defaultStrategy: "hover",
},
markdown: {
rehypePlugins: [
"rehype-slug",
["rehype-autolink-headings", { behavior: "append" }],
["rehype-toc", { headings: ["h2", "h3", "h4", "h5", "h6"] }],
[
"rehype-external-links",
{
content: {
type: "element",
tagName: "i",
children: [],
},
contentProperties: { className: ["external-link-icon"] },
target: "_blank",
rel: "nofollow noopener noreferrer",
},
],
],
shikiConfig: {
// Choose from Shiki's built-in themes (or add your own)
// https://github.com/shikijs/shiki/blob/main/docs/themes.md
theme: "material-theme-palenight",
},
},
i18n: {
defaultLocale: defaultLocale,
locales: [...astroI18nConfigPaths],
routing: "manual",
},
integrations: [
react(),
sitemap({
i18n: {
defaultLocale: defaultLocale,
locales: {
...localeKeys,
},
},
filter: (page) => {
return !page.includes("404");
},
}),
pagefind(),
icon({
...iconConfig,
}),
tailwind(),
paraglide({
project: "./src/project.inlang",
outdir: "./src/paraglide",
}),
expressiveCode(),
],
vite: {
server: {
port: PORT,
},
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
},
experimental: {
env: {
schema: envVars,
},
},
});