File size: 2,262 Bytes
d739b1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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)');