report the proper bare-mux version

This commit is contained in:
Percs 2024-04-19 09:25:04 -05:00
parent 769701d34c
commit 7ba90cb0cb
3 changed files with 15 additions and 3 deletions

View file

@ -30,7 +30,8 @@
"esbuild": "^0.19.11", "esbuild": "^0.19.11",
"esbuild-plugin-d.ts": "^1.2.2", "esbuild-plugin-d.ts": "^1.2.2",
"rollup": "^4.9.6", "rollup": "^4.9.6",
"rollup-plugin-typescript2": "^0.36.0" "rollup-plugin-typescript2": "^0.36.0",
"@rollup/plugin-replace": "^5.0.5"
}, },
"dependencies": { "dependencies": {
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",

View file

@ -1,7 +1,12 @@
import inject from '@rollup/plugin-inject'; import inject from '@rollup/plugin-inject';
import replace from '@rollup/plugin-replace';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { readFile } from 'node:fs/promises';
import typescript from 'rollup-plugin-typescript2'; import typescript from 'rollup-plugin-typescript2';
const pkg = JSON.parse(await readFile('package.json'));
process.env.BARE_MUX_VERSION = pkg.version;
/** /**
* @typedef {import('rollup').OutputOptions} OutputOptions * @typedef {import('rollup').OutputOptions} OutputOptions
* @typedef {import('rollup').RollupOptions} RollupOptions * @typedef {import('rollup').RollupOptions} RollupOptions
@ -22,6 +27,11 @@ const commonPlugins = () => [
) )
) )
), ),
replace({
'process.env.BARE_MUX_VERSION': JSON.stringify(
process.env.BARE_MUX_VERSION
),
}),
]; ];
/** /**

View file

@ -1,8 +1,9 @@
import { BareTransport } from "./BareTypes"; import { BareTransport } from "./BareTypes";
import RemoteTransport from "./RemoteClient"; import RemoteTransport from "./RemoteClient";
self.BCC_VERSION = "3.0.7"; //@ts-expect-error not installing node types for this one thing
console.debug("BCC_VERSION: " + self.BCC_VERSION); self.BCC_VERSION = process.env.BARE_MUX_VERSION;
console.debug("BARE_MUX_VERSION: " + self.BCC_VERSION);
declare global { declare global {
interface ServiceWorkerGlobalScope { interface ServiceWorkerGlobalScope {