From 3b677af830672759198a0bb8167b4929a9afd997 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 22 Aug 2026 11:02:15 +0200 Subject: fix: move meshbay-client build scripts out of gitignored build/ dir The root .gitignore ignores build/ (Python convention), which silently prevented sync-ui.js and its companion index.html from being committed. Rename to scripts/ so the files are tracked normally. Co-Authored-By: Claude Opus 4.6 --- packages/meshbay-client/package.json | 2 +- packages/meshbay-client/scripts/index.html | 27 ++++++++++++++++++ packages/meshbay-client/scripts/sync-ui.js | 46 ++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 packages/meshbay-client/scripts/index.html create mode 100644 packages/meshbay-client/scripts/sync-ui.js (limited to 'packages') diff --git a/packages/meshbay-client/package.json b/packages/meshbay-client/package.json index b9c5a50..3aa647a 100644 --- a/packages/meshbay-client/package.json +++ b/packages/meshbay-client/package.json @@ -7,7 +7,7 @@ "private": true, "scripts": { "start": "electron .", - "sync-ui": "node build/sync-ui.js", + "sync-ui": "node scripts/sync-ui.js", "dist": "npm run sync-ui && electron-builder --linux deb rpm" }, "devDependencies": { diff --git a/packages/meshbay-client/scripts/index.html b/packages/meshbay-client/scripts/index.html new file mode 100644 index 0000000..337e180 --- /dev/null +++ b/packages/meshbay-client/scripts/index.html @@ -0,0 +1,27 @@ + + + + + + MeshBay + + + + +
+ + + + + + + diff --git a/packages/meshbay-client/scripts/sync-ui.js b/packages/meshbay-client/scripts/sync-ui.js new file mode 100644 index 0000000..d0b6eee --- /dev/null +++ b/packages/meshbay-client/scripts/sync-ui.js @@ -0,0 +1,46 @@ +/** + * Copy the interface into this package. + * + * `packages/meshbay-hub/src/meshbay_hub/static/` is the single source of the + * interface, and it is *copied* here at build time rather than forked. A silent + * fork is the only real way to end up maintaining the UI twice, so this script + * refuses to leave a stale copy behind: it wipes the destination first, and CI + * fails if running it changes anything that was committed. + */ + +'use strict'; + +const fs = require('node:fs'); +const path = require('node:path'); + +const SRC = path.resolve(__dirname, '..', '..', 'meshbay-hub', 'src', + 'meshbay_hub', 'static'); +const DEST = path.resolve(__dirname, '..', 'ui'); + +// index.html is ours: the hub builds its own with a /a// prefix for cache +// busting, which an application loading from disk does not need and must not +// have — the prefix would point at the hub. +const OURS = ['index.html']; + +// sw.js has to sit at the root of the scope it serves, which it already does. +const SKIP = new Set(['webrtc-test.html']); + +function copyTree(from, to) { + fs.mkdirSync(to, { recursive: true }); + for (const entry of fs.readdirSync(from, { withFileTypes: true })) { + if (SKIP.has(entry.name)) continue; + const src = path.join(from, entry.name); + const dst = path.join(to, entry.name); + if (entry.isDirectory()) copyTree(src, dst); + else fs.copyFileSync(src, dst); + } +} + +fs.rmSync(DEST, { recursive: true, force: true }); +copyTree(SRC, DEST); +for (const name of OURS) { + fs.copyFileSync(path.join(__dirname, name), path.join(DEST, name)); +} + +const count = fs.readdirSync(DEST).length; +console.log(`ui/ rebuilt from ${path.relative(process.cwd(), SRC)} (${count} entries)`); -- cgit v1.2.3