diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..20a0c43 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish to npm + +on: + push: + tags: + - "v*" + +jobs: + publish: + name: Build & Publish + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - uses: actions/setup-node@v4 + with: + node-version: "20" + registry-url: "https://registry.npmjs.org" + - run: bun install --frozen-lockfile + - run: bun test + - run: bun run build + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index bf40ebd..c427a2d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @chatman/sales -[![CI](https://github.com/chatman-media/chatman_sales/actions/workflows/ci.yml/badge.svg)](https://github.com/chatman-media/chatman_sales/actions/workflows/ci.yml) +[![CI](https://github.com/chatman-media/sales/actions/workflows/ci.yml/badge.svg)](https://github.com/chatman-media/sales/actions/workflows/ci.yml) [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/runtime-Bun-fbf0df?logo=bun&logoColor=black)](https://bun.sh) [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE) diff --git a/bun.lock b/bun.lock index bdea7ee..97fb752 100644 --- a/bun.lock +++ b/bun.lock @@ -4,14 +4,15 @@ "workspaces": { "": { "name": "@chatman/sales", - "dependencies": { - "@chatman/rag": "github:chatman-media/chatbot_rag#7e48cc9734ccba170d35ca1196607297711957e6", - "zod": "^4.4.1", - }, "devDependencies": { "@biomejs/biome": "^2.4.14", + "@chatman/rag": "github:chatman-media/chatbot_rag#7e48cc9734ccba170d35ca1196607297711957e6", "@types/bun": "1.3.14", "typescript": "^6.0.3", + "zod": "^4.4.1", + }, + "peerDependencies": { + "zod": ">=4.0.0", }, }, }, @@ -34,7 +35,7 @@ "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.4.15", "", { "os": "win32", "cpu": "x64" }, "sha512-zBrGq5mx5wwpnow4+2BxUvleDM+GNd4sLbPaMapsSLQLD0NGRCquqPBTgN+7XkUteHvj7M+BstuI8tmnV7+HgQ=="], - "@chatman/rag": ["@chatman/rag@github:chatman-media/chatbot_rag#7e48cc9", { "dependencies": { "unpdf": "^1.6.2", "zod": "^4.4.1" } }, "chatman-media-chatbot_rag-7e48cc9", "sha512-dvDTCyl7yd4nij60KelDuw2RgXHw57qlzhwViLHzlxAV1euptRXzvad6v+9eJgjIKI6RAgndxtOTATgUUzou1A=="], + "@chatman/rag": ["@chatman/rag@github:chatman-media/chatbot_rag#7e48cc9", { "dependencies": { "unpdf": "^1.6.2", "zod": "^4.4.1" } }, "chatman-media-rag-7e48cc9", "sha512-GnHkTadRVKO/toSoZsspA6DuN7TcpC/cG1uPa/bUmAaMWPHOip8bnxwWKpyJjdJfdttHZeYor52MFexZiY9/yA=="], "@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="], diff --git a/package.json b/package.json index 95cd71b..23cf463 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,23 @@ "version": "0.1.0", "description": "LLM-powered sales funnel engine — persona composition, A/B testing, ELO rating, self-play evaluation for conversational bots.", "type": "module", - "main": "./src/index.ts", + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { - ".": "./src/index.ts" + ".": { + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + } }, + "files": [ + "dist", + "README.md", + "LICENSE" + ], "scripts": { + "build": "bun build ./src/index.ts --outdir ./dist --target node --format esm && tsc -p tsconfig.build.json", + "prepublishOnly": "bun test && bun run build", "typecheck": "tsc --noEmit", "check": "biome check ./src", "format": "biome format --write ./src", @@ -31,19 +43,20 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/chatman-media/chatman_sales.git" + "url": "https://github.com/chatman-media/sales.git" }, - "homepage": "https://github.com/chatman-media/chatman_sales#readme", + "homepage": "https://github.com/chatman-media/sales#readme", "bugs": { - "url": "https://github.com/chatman-media/chatman_sales/issues" + "url": "https://github.com/chatman-media/sales/issues" }, - "dependencies": { - "@chatman/rag": "github:chatman-media/chatbot_rag#7e48cc9734ccba170d35ca1196607297711957e6", - "zod": "^4.4.1" + "peerDependencies": { + "zod": ">=4.0.0" }, "devDependencies": { "@biomejs/biome": "^2.4.14", + "@chatman/rag": "github:chatman-media/chatbot_rag#7e48cc9734ccba170d35ca1196607297711957e6", "@types/bun": "1.3.14", - "typescript": "^6.0.3" + "typescript": "^6.0.3", + "zod": "^4.4.1" } } diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..a6c4795 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true, + "rootDir": "./src", + "outDir": "./dist" + }, + "exclude": ["src/__tests__/**"] +}