-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathastro.config.ts
36 lines (31 loc) · 1017 Bytes
/
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
import { defineConfig } from "astro/config";
import vue from "@astrojs/vue";
import mdx from "@astrojs/mdx";
import { execSync } from "child_process";
import { readFileSync } from "fs";
function git(command: string) {
return execSync(`git ${command}`, { encoding: "utf8" }).trim();
}
process.env.VUE_APP_BUILD_DATE = git("log -1 --format=%cd --date=iso");
process.env.VUE_APP_BUILD_VERSION = git("describe --always");
const pkg = JSON.parse(readFileSync("./package.json", { encoding: "utf8" }));
const dependencies = Object.keys(pkg.dependencies)
.map((dependency) =>
JSON.parse(
readFileSync(`node_modules/${dependency}/package.json`, {
encoding: "utf8",
}),
),
)
.map(({ name, version, license, homepage }) => ({
name,
version,
license,
homepage,
}));
process.env.VUE_APP_DEPENDENCIES = JSON.stringify(dependencies);
// https://astro.build/config
export default defineConfig({
// Enable Vue to support Vue components.
integrations: [vue(), mdx()],
});