mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 14:50:03 -04:00
feat: include commit hash in bare-mux builds
This commit is contained in:
parent
3fc18f1cf4
commit
98aae5c46c
3 changed files with 17 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
import replace from '@rollup/plugin-replace';
|
import replace from '@rollup/plugin-replace';
|
||||||
import terser from '@rollup/plugin-terser';
|
import terser from '@rollup/plugin-terser';
|
||||||
import typescript from 'rollup-plugin-typescript2';
|
import typescript from 'rollup-plugin-typescript2';
|
||||||
|
|
||||||
|
import { execSync } from "node:child_process";
|
||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
@ -13,8 +15,20 @@ const commonPlugins = () => [
|
||||||
'self.BARE_MUX_VERSION': JSON.stringify(
|
'self.BARE_MUX_VERSION': JSON.stringify(
|
||||||
pkg.version
|
pkg.version
|
||||||
),
|
),
|
||||||
}),
|
'self.BARE_MUX_COMMITHASH': (() => {
|
||||||
|
try {
|
||||||
|
let hash = JSON.stringify(
|
||||||
|
execSync("git rev-parse --short HEAD", {
|
||||||
|
encoding: "utf-8",
|
||||||
|
}).replace(/\r?\n|\r/g, "")
|
||||||
|
);
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
} catch (e) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
})(),
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
const configs = [
|
const configs = [
|
||||||
|
|
|
@ -11,4 +11,4 @@ export type * from './connection';
|
||||||
export type * from "./snapshot";
|
export type * from "./snapshot";
|
||||||
|
|
||||||
//@ts-expect-error this gets filled in
|
//@ts-expect-error this gets filled in
|
||||||
console.debug(`bare-mux: running v${self.BARE_MUX_VERSION}`);
|
console.debug(`bare-mux: running v${self.BARE_MUX_VERSION} (build ${self.BARE_MUX_COMMITHASH})`);
|
|
@ -88,4 +88,4 @@ self.onconnect = (event: MessageEvent) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-expect-error this gets filled in
|
//@ts-expect-error this gets filled in
|
||||||
console.debug(`bare-mux: running v${self.BARE_MUX_VERSION}`);
|
console.debug(`bare-mux: running v${self.BARE_MUX_VERSION} (build ${self.BARE_MUX_COMMITHASH})`);
|
Loading…
Add table
Add a link
Reference in a new issue