mirror of
https://github.com/1f349/admin.1f349.com.git
synced 2024-11-13 23:21:32 +00:00
22 lines
675 B
TypeScript
22 lines
675 B
TypeScript
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;
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [svelte()],
|
|
});
|