-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathastro.config.mjs
More file actions
179 lines (172 loc) · 5.28 KB
/
astro.config.mjs
File metadata and controls
179 lines (172 loc) · 5.28 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import path from "path";
import { loadEnv } from "vite";
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import remarkToc from "remark-toc";
import rehypeSlug from "rehype-slug";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import metaTags from "astro-meta-tags";
import deleteUnusedImages from "astro-delete-unused-images";
import { execSync } from "node:child_process";
import svelte from "@astrojs/svelte";
import compress from "astro-compress";
import tailwindcss from "@tailwindcss/vite";
let gitVersion = String(process.env.GIT_VERSION ?? "").slice(0, 7);
if (!gitVersion) {
try {
gitVersion = execSync("git rev-parse --short HEAD", {
stdio: ["ignore", "pipe", "ignore"],
})
.toString()
.trim();
} catch {
gitVersion = "unknown";
}
}
const mode =
process.argv.find((arg) =>
["development", "production", "preview"].includes(arg)
) || "production";
const fastBuild = loadEnv(mode, process.cwd(), "").EP_FAST_BUILD === "true";
console.log(
`\x1b[35m[EP]\x1b[0m Fast Build: \x1b[1m\x1b[34m${fastBuild}\x1b[0m`
);
function dontDie() {
return {
name: "dont-die",
hooks: {
"astro:config:setup": () => {
process.on("uncaughtException", (error) => {
if (
error.message &&
error.message.includes("Failed to load remote image")
) {
console.warn(
"[dont-die] Caught remote image error:",
error.message
);
return;
}
});
},
},
};
}
// https://astro.build/config
export default defineConfig({
vite: {
define: {
__TIMESTAMP__: JSON.stringify(
new Date()
.toISOString()
.replace(/[-:T.Z]/g, "")
.slice(0, 14)
),
__GIT_VERSION__: JSON.stringify(gitVersion),
},
resolve: {
alias: {
"@utils": path.resolve("./src/utils"),
"@data": path.resolve("./src/data"),
"@components": path.resolve("./src/components"),
"@stores": path.resolve("./src/stores"),
"@sections": path.resolve("./src/components/sections"),
"@layouts": path.resolve("./src/layouts"),
"@ui": path.resolve("./src/components/ui"),
"@assets": path.resolve("./src/assets"),
"@styles": path.resolve("./src/styles"),
"@i18n": path.resolve("./src/i18n"),
"@src": path.resolve("./src"),
},
},
plugins: [tailwindcss()],
},
markdown: {
remarkPlugins: [
[
remarkToc,
{
heading: "contents",
},
],
],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: "wrap",
},
],
],
plugins: [tailwindcss()],
},
site: process.env.SITE_URL || "https://ep2026.europython.eu",
redirects: {
// "/planning/": "https://forms.gle/riw6CvML8ck94A4V9",
// "/reviewers/": "https://forms.gle/4GTJjwZ1nHBGetM18",
// "/speaker/savannah-ostrowski": "/speaker/savannah-bailey",
// "/rust-summit": "/session/rust-summit",
// "/c-api-summit": "/session/c-api-summit",
// "/wasm-summit": "/session/webassembly-summit",
// "/programme/rust-summit": "/session/rust-summit",
// "/programme/c-api-summit": "/session/c-api-summit",
// "/programme/wasm-summit": "/session/webassembly-summit",
// "/discord": "https://discord.gg/BhTN2zJPMh",
// For AV team internal use: break screens
// "/break/forum-hall":
// "https://overlays.gbdl.in/ep-forum-hall/scene-schedule.html",
// "/break/north-hall":
// "https://overlays.gbdl.in/ep-north-hall/scene-schedule.html",
// "/break/south-hall-2a":
// "https://overlays.gbdl.in/ep-south-hall-2a/scene-schedule.html",
// "/break/south-hall-2b":
// "https://overlays.gbdl.in/ep-south-hall-2b/scene-schedule.html",
// "/break/terrace-2a":
// "https://overlays.gbdl.in/ep-terrace-2a/scene-schedule.html",
// "/break/terrace-2b":
// "https://overlays.gbdl.in/ep-terrace-2b/scene-schedule.html",
// // For AV team internal use: VDO ninja screen share
// "/ninja/forum-hall":
// "https://vdo.ninja/?room=EuroPython_2025_Forum_Hall&hash=338a&do",
// "/ninja/north-hall":
// "https://vdo.ninja/?room=EuroPython_2025_North_Hall&hash=338a&do",
// "/ninja/south-hall-2a":
// "https://vdo.ninja/?room=EuroPython_2025_Southhall_2A&hash=338a&do",
// "/ninja/south-hall-2b":
// "https://vdo.ninja/?room=EuroPython_2025_Southhall_2B&hash=338a&do",
// "/ninja/terrace-2a":
// "https://vdo.ninja/?room=EuroPython_2025_Terrace_2A&hash=338a&do",
// "/ninja/terrace-2b":
// "https://vdo.ninja/?room=EuroPython_2025_Terrace_2B&hash=338a&do",
},
integrations: [
mdx(),
svelte(),
...(fastBuild
? []
: [
sitemap(),
metaTags(),
deleteUnusedImages(),
compress({
HTML: false,
CSS: false,
SVG: false,
}),
dontDie(),
]),
],
output: "static",
build: {
...(fastBuild ? {} : { minify: true }),
},
image: {
remotePatterns: [{ protocol: "https" }],
domains: ["programme.europython.eu", "placehold.co"],
},
prefetch: {
prefetchAll: false,
},
});