diff --git a/package-lock.json b/package-lock.json index a76a021..49a7d05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@zablab/solar", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@zablab/solar", - "version": "0.1.0", + "version": "0.1.1", "dependencies": { "@preact/signals-react": "^3.2.1", "framer-motion": "^12.0.0", diff --git a/package.json b/package.json index 0d63b0e..f45ac17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zablab/solar", - "version": "0.1.0", + "version": "0.1.1", "description": "Solar — scene runtime bundle for the Zablab broadcast platform (Pulsar CEF + Prism webview + editor preview)", "type": "module", "private": true, @@ -26,7 +26,7 @@ }, "scripts": { "dev": "vite", - "build": "vite build", + "build": "vite build && node scripts/build-host-html.mjs", "lint": "eslint --max-warnings 0 .", "typecheck": "tsc -b --pretty", "format": "prettier --write .", diff --git a/scripts/build-host-html.mjs b/scripts/build-host-html.mjs new file mode 100644 index 0000000..42047ea --- /dev/null +++ b/scripts/build-host-html.mjs @@ -0,0 +1,87 @@ +#!/usr/bin/env node +/** + * Generates dist/index.html — the production bootstrap consumed by + * Pulsar CEF (browser source) and any other Solar host that loads the + * bundle as a static URL. + * + * The harness is the static counterpart of src/dev-entry.tsx : + * read URL query params, mount() Solar against the requested Orion + * endpoint with the requested mode/token. Inlined into the HTML so + * the host fetches a single file plus the already-bundled solar.js. + * + * Run as the second step of `npm run build` after `vite build`. + */ + +import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const here = dirname(fileURLToPath(import.meta.url)); +const root = resolve(here, ".."); +const distDir = resolve(root, "dist"); +const pkg = JSON.parse(readFileSync(resolve(root, "package.json"), "utf8")); + +mkdirSync(distDir, { recursive: true }); + +// One file, no external dependencies. Solar's CSS — if any — is +// inlined into solar.js by Vite's library mode, so we don't link a +// stylesheet here. The 100vh black background mirrors broadcast +// hosts' expectation (Pulsar CEF composites this as a transparent +// overlay over the operator's video sources). +const html = ` + + + + + + Solar + + + +
+ + + +`; + +const target = resolve(distDir, "index.html"); +writeFileSync(target, html); +const bytes = Buffer.byteLength(html, "utf8"); +console.log(`solar host html : ${bytes} B raw at ${target}`);