From 44693393387ffa128d8c33290c918e5022f750aa Mon Sep 17 00:00:00 2001 From: Rico040 <93081680+Rico040@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:23:51 +1000 Subject: [PATCH] build: use commit hash when release branch arg passed (#58) --- scripts/build.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index 1342e95..b1568f7 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -1,6 +1,7 @@ // @ts-nocheck /* eslint-disable no-restricted-syntax */ import swc from "@swc/core"; +import { execSync } from "child_process"; import crypto from "crypto"; import { build } from "esbuild"; import { readFile, writeFile } from "fs/promises"; @@ -116,7 +117,7 @@ const config = { export async function buildBundle() { context = { - hash: crypto.randomBytes(8).toString("hex").slice(0, 7) + hash: releaseBranch ? execSync("git rev-parse --short HEAD").toString().trim() : crypto.randomBytes(8).toString("hex").slice(0, 7) }; const initialStartTime = performance.now();