-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
31 lines (29 loc) · 956 Bytes
/
vite.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
/// <reference types="vitest" />
import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte"
import replace from "@rollup/plugin-replace"
import yaml from "@rollup/plugin-yaml"
import { execSync } from "child_process"
const quote = (str: string) => `"${str}"`
export default defineConfig({
plugins: [
replace({
__commitHash__: quote(
execSync(`git log -n 1 --pretty=format:%h`).toString().trim()
),
__commitDate__: quote(
new Date(
execSync(`git log -n 1 --pretty=format:%cd`).toString()
)
.toISOString()
.trim()
),
__buildDate__: quote(new Date().toISOString()),
__version__: quote(
execSync(`git describe --tags --abbrev=0`).toString().trim()
),
}),
svelte(),
yaml(),
],
})