forked from event-catalog/eventcatalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
66 lines (58 loc) · 1.96 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
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import pagefind from "astro-pagefind";
import { mermaid } from "./src/remark-plugins/mermaid"
import { join } from 'node:path';
/** @type {import('bin/eventcatalog.config').Config} */
import config from './eventcatalog.config';
import expressiveCode from 'astro-expressive-code';
const coreDirectory = process.env.CATALOG_DIR || process.cwd();
const base = config.base || '/';
// https://astro.build/config
export default defineConfig({
base,
server: { port: config.port || 3000 },
outDir: join(coreDirectory, 'dist'),
// https://docs.astro.build/en/reference/configuration-reference/#site
site: config.homepageLink || 'https://eventcatalog.dev/',
// https://docs.astro.build/en/reference/configuration-reference/#trailingslash
trailingSlash: config.trailingSlash === true ? "always" : "ignore",
// just turn this off for all users (for now...)
devToolbar: { enabled: false },
integrations: [
react(),
tailwind(),
expressiveCode({
themes: ['github-light'],
defaultProps: {
// Enable word wrap by default
wrap: true,
},
}),
mdx({
// https://docs.astro.build/en/guides/integrations-guide/mdx/#optimize
optimize: config.mdxOptimize || false,
remarkPlugins: [mermaid],
gfm: false,
}),
pagefind(),
],
vite: {
define: {
/**
* Trailing slash is exposed as global variable here principally for `@utils/url-builder`.
* The utility is used by client components and because of that it can't direct import
* the eventcatalog.config, as the config use packages that only run in node environments,
* such as `node:path`.
*/
'__EC_TRAILING_SLASH__': config.trailingSlash || false,
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
}
},
}
});