diff --git a/web/src/routes/version.json/+server.ts b/web/src/routes/version.json/+server.ts index 5d77a4ad1..c333616a3 100644 --- a/web/src/routes/version.json/+server.ts +++ b/web/src/routes/version.json/+server.ts @@ -1,5 +1,28 @@ import { json } from "@sveltejs/kit"; -import { getCommit, getBranch, getRemote, getVersion } from "@imput/version-info"; +import { exec } from "child_process"; +import { promisify } from "util"; + +const execAsync = promisify(exec); + +async function getCommit(): Promise { + const { stdout } = await execAsync("git rev-parse HEAD"); + return stdout.trim(); +} + +async function getBranch(): Promise { + const { stdout } = await execAsync("git rev-parse --abbrev-ref HEAD"); + return stdout.trim(); +} + +async function getRemote(): Promise { + const { stdout } = await execAsync("git config --get remote.origin.url"); + return stdout.trim(); +} + +async function getVersion(): Promise { + const { stdout } = await execAsync("git describe --tags --always"); + return stdout.trim(); +} export async function GET() { return json({ @@ -11,3 +34,5 @@ export async function GET() { } export const prerender = true; + +