From f4fc8d64bf6aa3a7d6eb7e7910cacc7064147da5 Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:40:51 -0500 Subject: [PATCH] log bare-mux version to console.debug --- rollup.config.js | 10 +++++++++- src/index.ts | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index e758a73..cdf9f1c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,11 @@ import inject from '@rollup/plugin-inject'; +import replace from '@rollup/plugin-replace'; import typescript from 'rollup-plugin-typescript2'; +import { readFile } from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; +const pkg = JSON.parse(await readFile('package.json')); + const commonPlugins = () => [ typescript(), inject( @@ -14,7 +18,11 @@ const commonPlugins = () => [ ) ) ), - + replace({ + 'self.BARE_MUX_VERSION': JSON.stringify( + pkg.version + ), + }), ]; const configs = [ diff --git a/src/index.ts b/src/index.ts index ca2466f..84def16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,3 +8,6 @@ export type * from './baretypes'; export type * from './client'; export type * from './connection'; export type * from "./snapshot"; + +//@ts-expect-error this gets filled in +console.debug("bare mux version: " + self.BARE_MUX_VERSION); \ No newline at end of file