admin.1f349.com/vite.config.ts

22 lines
675 B
TypeScript
Raw Normal View History

import {defineConfig} from "vite";
import {svelte} from "@sveltejs/vite-plugin-svelte";
import {exec} from "child_process";
import {promisify} from "util";
// Get current tag/commit and last commit date from git
const pexec = promisify(exec);
let [version, lastmod] = (
await Promise.allSettled([
pexec("git describe --tags || git rev-parse --short HEAD"),
pexec('git log -1 --format=%cd --date=format:"%Y-%m-%d %H:%M"'),
])
).map(v => (v as {value?: {stdout: string}}).value?.stdout.trim());
process.env.VITE_APP_VERSION = version;
process.env.VITE_APP_LASTMOD = lastmod;
2023-10-19 11:34:22 +01:00
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
});