Skip to content

Commit 4519bcd

Browse files
fix(ocm-cli): bundle TUI with solid plugin and declare peer deps
1 parent ed02dda commit 4519bcd

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

ocm-cli/package.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opencode-manager/ocm-cli",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "OpenCode Manager CLI: attach a local OpenCode TUI to a Manager-hosted repo.",
55
"license": "MIT",
66
"repository": {
@@ -14,7 +14,23 @@
1414
],
1515
"exports": {
1616
"./tui": {
17-
"import": "./dist/tui.tsx"
17+
"import": "./dist/tui.js"
18+
}
19+
},
20+
"peerDependencies": {
21+
"@opentui/core": ">=0.1.97",
22+
"@opentui/solid": ">=0.1.97",
23+
"solid-js": ">=1.9.11"
24+
},
25+
"peerDependenciesMeta": {
26+
"@opentui/core": {
27+
"optional": true
28+
},
29+
"@opentui/solid": {
30+
"optional": true
31+
},
32+
"solid-js": {
33+
"optional": true
1834
}
1935
},
2036
"bin": {

ocm-cli/scripts/build.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { chmodSync, copyFileSync, writeFileSync, rmSync, readFileSync } from 'fs'
1+
import { chmodSync, writeFileSync, rmSync, readFileSync } from 'fs'
22
import { join } from 'path'
3+
import solidPlugin from '@opentui/solid/bun-plugin'
34

45
const root = join(import.meta.dir, '..')
56
const dist = join(root, 'dist')
@@ -26,9 +27,24 @@ async function bundleEntry(label: string, entrypoint: string, outputName: string
2627
}
2728

2829
await bundleEntry('ocm CLI', join('bin', 'ocm.ts'), 'ocm.js')
29-
await bundleEntry('TUI plugin impl', join('src', 'tui-plugin.ts'), 'tui-plugin.js')
3030

31-
copyFileSync(join(root, 'src', 'tui.tsx'), join(dist, 'tui.tsx'))
31+
console.log('Bundling TUI plugin...')
32+
const tuiResult = await Bun.build({
33+
entrypoints: [join(root, 'src', 'tui.tsx')],
34+
outdir: dist,
35+
target: 'node',
36+
format: 'esm',
37+
plugins: [solidPlugin],
38+
external: ['@opentui/solid', '@opentui/core', 'solid-js'],
39+
naming: { entry: 'tui.js' },
40+
})
41+
42+
if (!tuiResult.success) {
43+
for (const log of tuiResult.logs) {
44+
console.error(log)
45+
}
46+
process.exit(1)
47+
}
3248

3349
const ocmJsPath = join(dist, 'ocm.js')
3450
const ocmJsContent = readFileSync(ocmJsPath, 'utf-8')

0 commit comments

Comments
 (0)