mirror of
https://github.com/PR0M3TH3AN/bitgate.git
synced 2026-10-27 16:41:03 +00:00
Widget styles now prefer --bitgate-* custom properties, falling back to the deprecated --gov-* names and then the existing defaults so current pages and overrides keep working. Browser bundles and ESM entry points expose VERSION (and window.bitgate.version) from package.json. Document allowlist on the widget policy preset list. Sync the lockfile so npm ci sees @bitgate/standalone. Co-authored-by: thePR0M3TH3AN <[email protected]>
28 lines
973 B
JavaScript
28 lines
973 B
JavaScript
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { build } from "esbuild";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { bitgateVersionPlugin, readLibraryVersion } from "../../../scripts/esbuild-bitgate-version.mjs";
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
const versionJs = join(HERE, "..", "..", "core", "src", "version.js");
|
|
|
|
describe("build-time version injection", () => {
|
|
it("replaces the version module with package.json's version", async () => {
|
|
const version = readLibraryVersion();
|
|
const result = await build({
|
|
entryPoints: [versionJs],
|
|
bundle: true,
|
|
write: false,
|
|
format: "esm",
|
|
platform: "neutral",
|
|
plugins: [bitgateVersionPlugin(version)],
|
|
});
|
|
|
|
const bundled = result.outputFiles[0].text;
|
|
expect(bundled).toContain(`VERSION = ${JSON.stringify(version)}`);
|
|
expect(bundled).not.toContain("Keep this string in lockstep");
|
|
});
|
|
});
|