-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
25 lines (23 loc) · 857 Bytes
/
vite.config.ts
File metadata and controls
25 lines (23 loc) · 857 Bytes
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
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, searchForWorkspaceRoot } from 'vite';
import pkg from "./package.json" with { type: "json" }
import fs from "node:fs/promises"
import { join } from 'node:path';
let ref = (await fs.readFile("./.git/HEAD").catch(_ => "Unknown")).toString().match(/ref:\s*(\S*)/)?.[1] ?? "N/A"
let commit = ref ? (await fs.readFile(join("./.git", ref)).catch(_ => "Unknown")).toString() : "N/A"
export default defineConfig({
plugins: [sveltekit()],
define: {
AQUANET_VERSION: JSON.stringify(pkg.version),
AQUANET_BUILD_TIME: JSON.stringify(Date.now()),
AQUANET_BUILD_BRANCH: JSON.stringify(ref === "N/A" ? "N/A" : (ref.match(/refs\/heads\/(\S*)/)?.[1] || ref.match(`refs/(\S*)`)?.[1])),
AQUANET_BUILD_COMMIT: JSON.stringify(commit),
},
server: {
fs: {
allow: [
".."
]
}
}
});