import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import {OCEAN_OPENWORK_CSS} from '../packages/core/src/bong/ocean-openwork-theme'; import {createOceanComponents,createOceanConversationModel,createOceanConversation,OCEAN_COMPONENTS_CSS} from '../packages/core/src/bong/ocean-components'; import { OCEAN_THEME_CSS } from '../packages/core/src/bong/ocean-theme'; import { BongAppShell } from '../packages/core/src/bong/app-shell.js'; const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const appShell = new BongAppShell(); let html: string; // 설명 문서: /docs/specs/bada-bong-appearance.md (v0.1.0) // HTML 생성이 실패해도 앱 셸이 소유한 엔진·리스너를 남기지 않는다. try { html = appShell.generateStandaloneHtml({ title: '봉(Bong) - 감성 인터랙션 & 로봇 동반자', forceGenesisWizard: false, // 설치형 봉은 BADA 데스크톱 Gateway에 연결한다. 별도 웹 서버의 기본 포트와 구분한다. wsGatewayUrl: 'ws://localhost:55070/bong/ws', }); } finally { appShell.dispose(); } fs.writeFileSync(path.join(rootDir, 'ocean-ui.js'),[createOceanComponents,createOceanConversationModel,createOceanConversation].map(fn=>fn.toString()).join('\n')+'\nglobalThis.BadaOcean={createOceanComponents,createOceanConversationModel,createOceanConversation};\n','utf-8'); fs.writeFileSync(path.join(rootDir, 'ocean-components.css'),OCEAN_COMPONENTS_CSS.trimEnd()+'\n','utf-8'); fs.writeFileSync(path.join(rootDir,'src/openwork/web/bada-ocean-theme.css'),OCEAN_OPENWORK_CSS.trimEnd()+'\n','utf-8'); fs.writeFileSync(path.join(rootDir,'src/openwork/web/bada-ocean-components.css'),OCEAN_COMPONENTS_CSS.trimEnd()+'\n','utf-8'); fs.writeFileSync(path.join(rootDir, 'ocean-theme.css'), OCEAN_THEME_CSS + '\n', 'utf-8'); fs.writeFileSync(path.join(rootDir, 'artifacts/bong-app.html'), html, 'utf-8'); fs.writeFileSync(path.join(rootDir, 'apps/bong-app-project/app/src/main/assets/index.html'), html, 'utf-8'); fs.writeFileSync(path.join(rootDir, 'apps/bong-android/app/src/main/assets/index.html'), html, 'utf-8'); console.log('✅ HTML 아티팩트 및 안드로이드 Assets 갱신 완료 (크기: ' + html.length + ' bytes)');