Aggregator that builds the static demo bundle for each fastcomments-* frontend
integration repo and stages them under dist/<slug>/ so the main fastcomments
worker can serve each at /commenting-system-for-<slug>.
After node build.mjs runs, dist/ looks like:
dist/
react/ ← served at /commenting-system-for-react
react-native/ ← served at /commenting-system-for-react-native
vue/ ← served at /commenting-system-for-vue
angular/ ← served at /commenting-system-for-angular
svelte/ ← served at /commenting-system-for-svelte
astro/ ← served at /commenting-system-for-astro
11ty/ ← served at /commenting-system-for-11ty
gatsby/ ← served at /commenting-system-for-gatsby
nextjs/ ← served at /commenting-system-for-nextjs
One-off demos live in tmp_demos/<slug>/ in this repo (each is a small vite
app whose npm run build emits dist/). The build stages them at
dist/tmp_demos/<slug>/ and the worker serves everything under that
directory at fastcomments.com/tmp_demos/<slug> through a single static
mount, so shipping a new one requires NO worker changes:
- Create
tmp_demos/<slug>/withindex.html,src/,package.json(with abuildscript), and a vite config usingbase: './'(assets must be relative because the bundle serves from a subpath). - Append
{ slug, deps }to theTMP_DEMOSarray inbuild.mjs.depsare repos cloned intobuild/as siblings of the staged demo before it builds;refpins a branch,prepareruns once per dep (e.g. compile a library the demo links against). - Deploy as usual; the demo is live at
/tmp_demos/<slug>.
tmp_demos/idcollab is the reference example: it builds the React Native
SDK from source (pinned branch) against a compiled fastcomments-sdk-js
sibling.
By default build.mjs clones each repo fresh from GitHub. To reuse local
checkouts for faster iteration, point at a parent directory that contains the
fastcomments-* repos as siblings:
DEMOS_LOCAL_SOURCE_DIR=/home/winrid/dev/fastcomments node build.mjs
To build a subset, filter by slug (note dist/ is wiped at the start of
every run, so only deploy full builds):
DEMOS_FILTER=idcollab node build.mjs
- Add a
build-demo.mjsto the new frontend repo that produces a static bundle at<repo-root>/demo-dist/. - Append
{ slug, repo }to theLIBSarray inbuild.mjs. - Add the matching slug to the
DEMO_LIBSconstant in the fastcomments worker so a static mount is registered. - Add the new URL to
routes/sitemap.tsADDITIONAL_PATHS.
Deployed via the orchestrator. Build runs in /tmp/fastcomments-demos
on the orchestrator host (customBuildCommand: "node build.mjs"), then
the resulting tree is rsynced to /home/winrid/fastcomments-demos/ on
each fastcomments instance.