Skip to content

Commit c7d6778

Browse files
committed
build: migrate from bun to pnpm and vitest
1 parent bea6b62 commit c7d6778

77 files changed

Lines changed: 4604 additions & 1101 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,28 @@ jobs:
1717

1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v5
2121

22-
- name: Setup Bun
23-
uses: oven-sh/setup-bun@v2
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
2427
with:
25-
bun-version: 1.2.22
28+
node-version: '22'
29+
cache: 'pnpm'
2630

2731
- name: Install dependencies
28-
run: bun install --frozen-lockfile
32+
run: pnpm install --frozen-lockfile
2933

3034
- name: Lint
31-
run: bun run lint
35+
run: pnpm run lint
3236

3337
- name: Type check
34-
run: bun run type-check
38+
run: pnpm run type-check
3539

3640
- name: Build
37-
run: bun run build
41+
run: pnpm run build
3842

3943
- name: Test
40-
run: bun run test --timeout 30000
44+
run: pnpm run test

.github/workflows/deploy-docs.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ jobs:
2121
build:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
with:
2626
fetch-depth: 0
27-
- uses: oven-sh/setup-bun@v2
28-
- run: bun install --frozen-lockfile
29-
- run: bun run docs:build
27+
- uses: pnpm/action-setup@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: '22'
31+
cache: 'pnpm'
32+
- run: pnpm install --frozen-lockfile
33+
- run: pnpm run docs:build
3034
- uses: actions/configure-pages@v4
3135
- uses: actions/upload-pages-artifact@v3
3236
with:

CONTRIBUTING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Thank you for your interest in contributing to Blade Agent SDK! This document provides guidelines and standards for contributing to this project.
44

5-
The published package is distributed through npm, but this repository uses `bun` for local dependency installation, testing, build, and release automation.
5+
The published package is distributed through npm, but this repository uses `pnpm` for local dependency installation, testing, build, and release automation.
66

77
## Code Standards
88

@@ -54,21 +54,21 @@ const name = user?.profile?.name ?? 'Anonymous';
5454
Run linting before submitting:
5555

5656
```bash
57-
bun run lint
57+
pnpm run lint
5858
```
5959

6060
Fix auto-fixable issues:
6161

6262
```bash
63-
bun run lint:fix
63+
pnpm run lint:fix
6464
```
6565

6666
### Type Checking
6767

6868
Ensure your code passes type checking:
6969

7070
```bash
71-
bun run type-check
71+
pnpm run type-check
7272
```
7373

7474
## Development Workflow
@@ -78,7 +78,7 @@ bun run type-check
7878
```bash
7979
git clone https://github.com/YOUR_USERNAME/blade-agent-sdk.git
8080
cd blade-agent-sdk
81-
bun install
81+
pnpm install
8282
```
8383

8484
### 2. Create a Branch
@@ -96,14 +96,14 @@ git checkout -b feature/your-feature-name
9696
### 4. Test Your Changes
9797

9898
```bash
99-
bun test
99+
pnpm test
100100
```
101101

102102
### 5. Verify Code Quality
103103

104104
```bash
105-
bun run type-check
106-
bun run lint
105+
pnpm run type-check
106+
pnpm run lint
107107
```
108108

109109
### 6. Commit and Push
@@ -126,9 +126,9 @@ Open a PR against the `main` branch with:
126126

127127
Before submitting a PR, ensure:
128128

129-
- [ ] Code compiles without errors (`bun run type-check`)
130-
- [ ] All tests pass (`bun test`)
131-
- [ ] Linting passes (`bun run lint`)
129+
- [ ] Code compiles without errors (`pnpm run type-check`)
130+
- [ ] All tests pass (`pnpm test`)
131+
- [ ] Linting passes (`pnpm run lint`)
132132
- [ ] No `any` types introduced
133133
- [ ] New features have tests
134134
- [ ] Documentation updated if needed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
```bash
2121
npm install @blade-ai/agent-sdk
2222
#
23-
bun add @blade-ai/agent-sdk
23+
pnpm add @blade-ai/agent-sdk
2424
```
2525

26-
已发布包面向 npm 分发;这个仓库本身使用 `bun` 进行依赖安装、构建、测试、发布和文档开发。
26+
已发布包面向 npm 分发;这个仓库本身使用 `pnpm` 进行依赖安装、构建、测试、发布和文档开发。
2727

2828
## 快速开始
2929

@@ -90,12 +90,12 @@ README 只保留概览。详细用法请直接看文档:
9090
## 仓库开发
9191

9292
```bash
93-
bun install
94-
bun run build
95-
bun test
96-
bun run type-check
97-
bun run lint
98-
bun run docs:dev
93+
pnpm install
94+
pnpm run build
95+
pnpm test
96+
pnpm run type-check
97+
pnpm run lint
98+
pnpm run docs:dev
9999
```
100100

101101
更多贡献约定见 [CONTRIBUTING.md](./CONTRIBUTING.md)

bun.lock

Lines changed: 0 additions & 812 deletions
This file was deleted.

docs/blade-agent-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
```bash
1010
npm install @blade-ai/agent-sdk
1111
#
12-
bun add @blade-ai/agent-sdk
12+
pnpm add @blade-ai/agent-sdk
1313
```
1414

1515
## 最小示例:流式对话

docs/hooks.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ const session = await createSession({
353353
],
354354
[HookEvent.SessionEnd]: [
355355
async () => {
356-
await Bun.write('audit.json', JSON.stringify(auditLog, null, 2));
356+
const { writeFileSync } = await import('node:fs');
357+
writeFileSync('audit.json', JSON.stringify(auditLog, null, 2));
357358
return { action: 'continue' };
358359
},
359360
],

package.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": false,
55
"description": "Blade AI Agent SDK",
66
"type": "module",
7-
"packageManager": "bun@1.3.11",
7+
"packageManager": "pnpm@10.6.0",
88
"main": "./dist/index.js",
99
"types": "./dist/index.d.ts",
1010
"exports": {
@@ -20,16 +20,16 @@
2020
"CHANGELOG.md"
2121
],
2222
"scripts": {
23-
"build": "bun run scripts/build.ts",
24-
"test": "bun test",
23+
"build": "tsup && tsc -p tsconfig.build.json",
24+
"test": "vitest run",
2525
"lint": "biome lint src",
2626
"lint:fix": "biome lint --write src",
27-
"type-check": "bun x tsc --noEmit",
28-
"release": "bun run scripts/release.js",
29-
"release:dry": "bun run scripts/release.js --dry-run",
30-
"release:major": "bun run scripts/release.js --major",
31-
"release:minor": "bun run scripts/release.js --minor",
32-
"release:patch": "bun run scripts/release.js --patch",
27+
"type-check": "tsc --noEmit",
28+
"release": "node scripts/release.js",
29+
"release:dry": "node scripts/release.js --dry-run",
30+
"release:major": "node scripts/release.js --major",
31+
"release:minor": "node scripts/release.js --minor",
32+
"release:patch": "node scripts/release.js --patch",
3333
"docs:dev": "vitepress dev docs",
3434
"docs:build": "vitepress build docs",
3535
"docs:preview": "vitepress preview docs"
@@ -41,7 +41,7 @@
4141
"assistant",
4242
"agent",
4343
"llm",
44-
"bun"
44+
"node"
4545
],
4646
"author": "echoVic",
4747
"license": "MIT",
@@ -51,7 +51,6 @@
5151
"@ai-sdk/deepseek": "^2.0.4",
5252
"@ai-sdk/google": "^3.0.4",
5353
"@vscode/ripgrep": "^1.17.0",
54-
"bun-pty": "^0.4.8",
5554
"node-pty": "1.0.0"
5655
},
5756
"dependencies": {
@@ -91,8 +90,10 @@
9190
"@types/semver": "^7.7.1",
9291
"@types/write-file-atomic": "^4.0.3",
9392
"@types/ws": "^8.5.12",
94-
"bun-types": "latest",
93+
"@types/node": "^22.15.0",
94+
"tsup": "^8.4.0",
9595
"typescript": "^5.9.2",
96-
"vitepress": "^1.6.4"
96+
"vitepress": "^1.6.4",
97+
"vitest": "^3.1.0"
9798
}
9899
}

0 commit comments

Comments
 (0)