build: use commit hash when release branch arg passed (#58)

This commit is contained in:
Rico040 2024-06-25 11:23:51 +10:00 • committed by GitHub
parent bf21e98c5b
commit 4469339338
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();