generated from hasparus/zaduma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
79 lines (74 loc) · 2.37 KB
/
astro.config.ts
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
import mdx from "@astrojs/mdx";
import solidJs from "@astrojs/solid-js";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { rehypePlugins, remarkPlugins } from "./src/build-time";
import react from "@astrojs/react";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Production URL
const hostname = "siddharthcodes.vercel.app";
const site = `https://${hostname}/`;
// https://astro.build/config
export default defineConfig({
site,
markdown: {
// We'll highlight using Shiki Twoslash remark plugin
syntaxHighlight: false,
},
integrations: [
tailwind({
applyBaseStyles: false,
}),
mdx({
extendMarkdownConfig: true,
// MDX integration inherits all remark plugins from markdown.remarkPlugins
remarkPlugins: remarkPlugins(__dirname),
rehypePlugins: rehypePlugins,
}),
solidJs({
exclude: [
"src/lib/3d-pin/3d-pin.tsx",
"src/lib/bento-grid/bento-grid.tsx",
"src/lib/background-gradient/background-gradient.tsx"
],
}),
react({
include: [
"src/lib/3d-pin/3d-pin.tsx",
"src/lib/bento-grid/bento-grid.tsx",
"src/lib/background-gradient/background-gradient.tsx"
],
}),
],
vite: {
ssr: {
noExternal: [
"@fontsource-variable/inter",
"@fontsource-variable/brygada-1918",
],
},
define: {
"import.meta.env.PUBLIC_URL": JSON.stringify(makePublicURL()),
},
},
});
function makePublicURL() {
const VERCEL_URL = process.env.VERCEL_URL;
const DEPLOYMENT_ALIAS = process.env.DEPLOYMENT_ALIAS;
// If the site is built on vercel, we can just use VERCEL_URL.
if (VERCEL_URL) return VERCEL_URL;
if (!DEPLOYMENT_ALIAS) {
// If there's no DEPLOYMENT_ALIAS nor VERCEL_URL, we assume we're building locally.
return "http://localhost:3000/";
}
// Otherwise, we build on GitHub Actions (and get access to Git History).
// If DEPLOYMENT_ALIAS is set to `main--${hostname}`, we're on the main branch,
// and we return the canonical URL.
if (DEPLOYMENT_ALIAS === `main--${hostname}`) return site;
// Otherwise, we're building a preview deployment, and set the deployment alias
// in `import.meta.env.PUBLIC_URL`.
return `https://${DEPLOYMENT_ALIAS}`;
}