Files
hanzo.ai/scripts/rooms-assets.mjs
zeekay 6c65e3e941 @hanzo/app 0.2.0: the app SDK, renamed from @hanzo/rooms
Every import, the catalog pin and the docs name @hanzo/app and
github.com/hanzoai/app. lib/rooms.ts is lib/app.ts and
components/rooms.tsx is components/app.tsx.
2026-10-22 19:07:20 -07:00

19 lines
972 B
JavaScript

// Serve @hanzo/app' files at this site's root: the cast's portraits
// (`/agents/<id>.png`) and the Bots room's avatars (`/bots/<name>.png`).
//
// The rooms name them by path and the package ships them in `assets/`; this
// copies that tree into `public/`, where the export serves it. The copy is a
// build product, ignored by git, so the package is the one place a portrait
// lives and a new one reaches this site with the next rooms release.
//
// Wired to `prebuild` and `predev`.
import { cpSync, existsSync } from 'node:fs'
import { createRequire } from 'node:module'
import { dirname, join } from 'node:path'
const require = createRequire(import.meta.url)
// The package's entry is dist/index.js; assets/ sits beside dist/.
const from = join(dirname(require.resolve('@hanzo/app')), '..', 'assets')
if (!existsSync(from)) throw new Error(`@hanzo/app ships no assets/ at ${from}`)
cpSync(from, new URL('../public', import.meta.url).pathname, { recursive: true })