mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
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.
19 lines
972 B
JavaScript
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 })
|