commit 1242672fd2ac96e783b891d7823b4e5880d2a99c
parent beccee009b0a151887daa35b2cac0722f7b4ca8b
Author: Florian Dold <florian@dold.me>
Date: Sun, 19 Jul 2026 18:07:33 +0200
fix fetching of git ref in build script
We shouldn't try to reimplement git here, when git refs are packed, the
old implementation just fails.
Diffstat:
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/packages/merchant-backend-ui/build.mjs b/packages/merchant-backend-ui/build.mjs
@@ -18,6 +18,7 @@
import esbuild from "esbuild";
import path from "node:path";
import fs from "node:fs";
+import { execSync } from 'node:child_process';
// eslint-disable-next-line no-undef
const BASE = process.cwd();
@@ -63,17 +64,7 @@ function get_version() {
}
function git_hash() {
- const rev = fs
- .readFileSync(path.join(GIT_ROOT, ".git", "HEAD"))
- .toString()
- .trim()
- .split(/.*[: ]/)
- .slice(-1)[0];
- if (rev.indexOf("/") === -1) {
- return rev;
- } else {
- return fs.readFileSync(path.join(GIT_ROOT, ".git", rev)).toString().trim();
- }
+ return execSync(`git rev-parse HEAD`, { encoding: 'utf-8' }).trim();
}
function toCamelCaseName(name, lang) {
return name