Files
plainleaf/update_version.ts
T
Lennart OchelandGitHub 2ef644791b Generate version from git describe at build time (#1374)
* Generate version from git describe at build time

* Add 2.0-beta prefix

* Use Deno.Command instead of Deno.run
2025-05-07 18:52:07 +02:00

17 lines
573 B
TypeScript

export async function updateVersionFile() {
const command = new Deno.Command("git", {
args: ["describe", "--tags", "--long", "--dirty"],
stdout: "piped",
stderr: "piped",
});
const { stdout } = await command.output();
const commitVersion = new TextDecoder().decode(stdout).trim();
const versionFilePath = "./version.ts";
const versionContent = `export const version = "2.0-beta (${commitVersion})";\n`;
await Deno.writeTextFile(versionFilePath, versionContent);
console.log(`Updated version.ts with version information: ${commitVersion}`);
}