diff --git a/.gitignore b/.gitignore index bd681d0..494bdae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .env .env.local node_modules -.pnpm-store \ No newline at end of file +.pnpm-store + +dist \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..6948c8c --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN} +//npm.cnb.cool/kevisual/registry/-/packages/:_authToken=${CNB_API_KEY} +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/.opencode/plugins/cnb.ts b/.opencode/plugins/cnb.ts index a062919..ccd207b 100644 --- a/.opencode/plugins/cnb.ts +++ b/.opencode/plugins/cnb.ts @@ -1 +1 @@ -export * from "../../agent/opencode-plugin"; \ No newline at end of file +export * from "../../agent/opencode"; \ No newline at end of file diff --git a/agent/opencode-plugin.ts b/agent/opencode.ts similarity index 100% rename from agent/opencode-plugin.ts rename to agent/opencode.ts diff --git a/bun.config.ts b/bun.config.ts index e69de29..14802cc 100644 --- a/bun.config.ts +++ b/bun.config.ts @@ -0,0 +1,19 @@ +import { resolvePath } from '@kevisual/use-config'; +import { execSync } from 'node:child_process'; + +const entry = 'agent/opencode.ts'; +const naming = 'opencode'; +const external: string[] = ["bun"]; +await Bun.build({ + target: 'node', + format: 'esm', + entrypoints: [resolvePath(entry, { meta: import.meta })], + outdir: resolvePath('./dist', { meta: import.meta }), + naming: { + entry: `${naming}.js`, + }, + external, +}); + +const cmd = 'dts -i agent/opencode.ts -o opencode.d.ts'; +execSync(cmd); \ No newline at end of file diff --git a/package.json b/package.json index 485bd4a..416e3a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/cnb", - "version": "0.0.1", + "version": "0.0.3", "description": "", "main": "index.js", "scripts": { @@ -8,6 +8,7 @@ }, "keywords": [], "files": [ + "dist", "src", "mod.ts", "agent" @@ -35,5 +36,11 @@ "es-toolkit": "^1.44.0", "nanoid": "^5.1.6", "zod": "^4.3.6" + }, + "exports": { + ".": "./mod.ts", + "./opencode": "./dist/opencode.js", + "./src/*": "./src/*", + "./agent/*": "./agent/*" } } \ No newline at end of file