mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(ocm-cli): workspace repo sync and manager token targeting (#233)
This commit is contained in:
1 parent
e12f319592
commit
a86e4b1238
69 files changed
+4858
-161
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { chmodSync, writeFileSync, rmSync, readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
const root = join(import.meta.dir, '..')
|
||||
const dist = join(root, 'dist')
|
||||
|
||||
rmSync(dist, { recursive: true, force: true })
|
||||
|
||||
console.log('Bundling ocm CLI...')
|
||||
const cliResult = await Bun.build({
|
||||
entrypoints: [join(root, 'bin', 'ocm.ts')],
|
||||
outdir: dist,
|
||||
target: 'node',
|
||||
format: 'esm',
|
||||
naming: { entry: 'ocm.js' },
|
||||
})
|
||||
|
||||
if (!cliResult.success) {
|
||||
for (const log of cliResult.logs) {
|
||||
console.error(log)
|
||||
}
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('Bundling opencode plugin entry...')
|
||||
const pluginResult = await Bun.build({
|
||||
entrypoints: [join(root, 'src', 'plugin.ts')],
|
||||
outdir: dist,
|
||||
target: 'node',
|
||||
format: 'esm',
|
||||
naming: { entry: 'plugin.js' },
|
||||
})
|
||||
|
||||
if (!pluginResult.success) {
|
||||
for (const log of pluginResult.logs) {
|
||||
console.error(log)
|
||||
}
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const ocmJsPath = join(dist, 'ocm.js')
|
||||
const ocmJsContent = readFileSync(ocmJsPath, 'utf-8')
|
||||
const withoutShebang = ocmJsContent.startsWith('#!') ? ocmJsContent.slice(ocmJsContent.indexOf('\n') + 1) : ocmJsContent
|
||||
writeFileSync(ocmJsPath, `#!/usr/bin/env node\n${withoutShebang}`)
|
||||
chmodSync(ocmJsPath, 0o755)
|
||||
|
||||
console.log('Build complete')
|
||||
Reference in new issue
Block a user