diff --git a/rollup.config.js b/rollup.config.js index 9cea400..2d3592a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,6 +1,8 @@ import replace from '@rollup/plugin-replace'; import terser from '@rollup/plugin-terser'; import typescript from 'rollup-plugin-typescript2'; + +import { execSync } from "node:child_process"; import { readFile } from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; @@ -13,8 +15,20 @@ const commonPlugins = () => [ 'self.BARE_MUX_VERSION': JSON.stringify( 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 = [ diff --git a/src/index.ts b/src/index.ts index ae661c9..ffd085c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,4 +11,4 @@ export type * from './connection'; export type * from "./snapshot"; //@ts-expect-error this gets filled in -console.debug(`bare-mux: running v${self.BARE_MUX_VERSION}`); \ No newline at end of file +console.debug(`bare-mux: running v${self.BARE_MUX_VERSION} (build ${self.BARE_MUX_COMMITHASH})`); \ No newline at end of file diff --git a/src/worker.ts b/src/worker.ts index da84ca4..75d7a4d 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -88,4 +88,4 @@ self.onconnect = (event: MessageEvent) => { } //@ts-expect-error this gets filled in -console.debug(`bare-mux: running v${self.BARE_MUX_VERSION}`); \ No newline at end of file +console.debug(`bare-mux: running v${self.BARE_MUX_VERSION} (build ${self.BARE_MUX_COMMITHASH})`); \ No newline at end of file