feat: 重构代码结构,更新插件导出,添加构建配置和npm配置文件

This commit is contained in:
xiongxiao
2026-01-27 04:12:07 +08:00
parent 50332fe2f4
commit b15b11fa02
6 changed files with 34 additions and 3 deletions

4
.gitignore vendored
View File

@@ -1,4 +1,6 @@
.env
.env.local
node_modules
.pnpm-store
.pnpm-store
dist

3
.npmrc Normal file
View File

@@ -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}

View File

@@ -1 +1 @@
export * from "../../agent/opencode-plugin";
export * from "../../agent/opencode";

View File

@@ -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);

View File

@@ -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/*"
}
}