Files
bitgate/packages/site/build.mjs
T
thePR0M3TH3AN b24bf3955d feat(site): BitGate landing page, integration guide, and live demo
A sibling of the BitLogin design system rather than a twin: the same
ink/paper/brass foundation and serif display, with verdigris — the patina brass
takes as it ages — where BitLogin uses its violet seal.

- index: the signature visual is the product's whole argument, one listing
  reaching four surfaces and getting four different verdicts
- docs: five-step integration, elements table, presets, common mistakes
- demo: the real engine running in the browser against an in-memory transport,
  so nothing is fetched or published. Add reports, restrict the seller, switch
  moderator identities, and watch every surface re-decide.

The widget bundle now re-exports the runtime and core entry points, because a
static page has no package manager — anything it might need has to be reachable
from the one file it loads.

Also fixes the site build reusing a stale widget bundle. It only rebuilt when
the file was missing, which is precisely how a broken demo ships: the page
loads, the module resolves, and an export added since the last build is
silently absent. Caught by running it.

vercel.json mirrors BitLogin's security headers, with connect-src widened to
wss: for relay traffic.
2026-08-09 20:30:03 -04:00

34 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Assemble the static site.
*
* Copies `public/` and drops the built widget in at `vendor/bitgate/`, which is
* the same path the docs tell integrators to use — so the site is itself an
* example of the instructions it gives.
*/
import { cpSync, mkdirSync, rmSync } from "node:fs";
import { execSync } from "node:child_process";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const HERE = dirname(fileURLToPath(import.meta.url));
const widgetDir = join(HERE, "..", "widget");
const widgetDist = join(widgetDir, "dist");
const publicDir = join(HERE, "public");
const outDir = join(HERE, "dist");
// Always rebuild rather than reusing whatever is on disk. A stale bundle is
// exactly how a broken demo ships: the page loads, the module resolves, and an
// export added since the last build is silently missing.
console.log("Building @bitgate/widget…");
execSync("node build.mjs", { cwd: widgetDir, stdio: "inherit" });
rmSync(outDir, { recursive: true, force: true });
mkdirSync(outDir, { recursive: true });
cpSync(publicDir, outDir, { recursive: true });
mkdirSync(join(outDir, "vendor", "bitgate"), { recursive: true });
cpSync(widgetDist, join(outDir, "vendor", "bitgate"), { recursive: true });
console.log(`✓ Built ${outDir}`);