Skip to content

Commit db54528

Browse files
committed
use changeset to manage versioning and changelogs
1 parent cdcef9e commit db54528

File tree

11 files changed

+1635
-89
lines changed

11 files changed

+1635
-89
lines changed

.changeset/EXAMPLE_WORKFLOW.md

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
# Complete Example: Adding a Feature and Publishing
2+
3+
This is a step-by-step walkthrough of adding a feature and releasing it.
4+
5+
## Scenario
6+
7+
You want to add a new `useMcpTools()` React hook to the `mcp-use` package.
8+
9+
## Step 1: Create Feature Branch
10+
11+
```bash
12+
git checkout main
13+
git pull origin main
14+
git checkout -b feat/add-use-mcp-tools-hook
15+
```
16+
17+
## Step 2: Implement the Feature
18+
19+
```typescript
20+
// packages/mcp-use/src/react/hooks/useMcpTools.ts
21+
import { useState, useEffect } from 'react';
22+
import { MCPClient } from '../../client.js';
23+
24+
export function useMcpTools(serverName: string) {
25+
const [tools, setTools] = useState([]);
26+
const [loading, setLoading] = useState(true);
27+
28+
useEffect(() => {
29+
// Implementation...
30+
}, [serverName]);
31+
32+
return { tools, loading };
33+
}
34+
35+
// Export from packages/mcp-use/src/react/index.ts
36+
export { useMcpTools } from './hooks/useMcpTools.js';
37+
```
38+
39+
## Step 3: Build and Test Locally
40+
41+
```bash
42+
# Build all packages
43+
pnpm build
44+
45+
# Output:
46+
# packages/mcp-use build: ESM ⚡️ Build success in 42ms
47+
# packages/mcp-use build: CJS ⚡️ Build success in 42ms
48+
# ✓ All packages built successfully
49+
50+
# Run tests
51+
pnpm test
52+
53+
# Run linter
54+
pnpm lint
55+
```
56+
57+
## Step 4: Create a Changeset
58+
59+
```bash
60+
pnpm changeset
61+
```
62+
63+
**Interactive Prompts:**
64+
65+
```
66+
🦋 Which packages would you like to include?
67+
◉ mcp-use
68+
◯ @mcp-use/cli
69+
◯ @mcp-use/inspector
70+
◯ create-mcp-use-app
71+
72+
🦋 What kind of change is this for mcp-use?
73+
◯ major
74+
◉ minor ← Select this (new feature)
75+
◯ patch
76+
77+
🦋 Please enter a summary for this change (this will be written to the changelog):
78+
Added useMcpTools React hook for easier tool management
79+
```
80+
81+
**Result:** Creates `.changeset/random-name-here.md`
82+
83+
```md
84+
---
85+
"mcp-use": minor
86+
---
87+
88+
Added useMcpTools React hook for easier tool management
89+
```
90+
91+
## Step 5: Commit Everything
92+
93+
```bash
94+
git add .
95+
git commit -m "feat: add useMcpTools React hook"
96+
git push origin feat/add-use-mcp-tools-hook
97+
```
98+
99+
## Step 6: Create Pull Request
100+
101+
Create a PR on GitHub with:
102+
103+
**Title:** `feat: add useMcpTools React hook`
104+
105+
**Description:**
106+
```markdown
107+
## What
108+
109+
Adds a new `useMcpTools()` React hook for managing MCP tools.
110+
111+
## Why
112+
113+
Simplifies tool management in React applications.
114+
115+
## Changes
116+
117+
- Added `useMcpTools` hook in `packages/mcp-use/src/react/hooks/`
118+
- Exported from `mcp-use/react`
119+
- Added tests for the new hook
120+
121+
## Changeset
122+
123+
✅ Changeset included (minor bump for mcp-use)
124+
```
125+
126+
## Step 7: Review & Merge
127+
128+
After review and approval:
129+
130+
```bash
131+
# Merge the PR to main
132+
```
133+
134+
## Step 8: Release (Maintainer Task)
135+
136+
On the `main` branch after merge:
137+
138+
```bash
139+
# Switch to main and pull
140+
git checkout main
141+
git pull origin main
142+
143+
# Check what will be versioned
144+
pnpm version:check
145+
```
146+
147+
**Output:**
148+
```
149+
🦋 info Packages to be bumped at minor:
150+
🦋 - mcp-use (0.2.0 → 0.3.0)
151+
🦋
152+
🦋 info Packages to be bumped at patch:
153+
🦋 - @mcp-use/cli (2.0.1 → 2.0.2) ← depends on mcp-use
154+
🦋 - @mcp-use/inspector (0.1.0 → 0.1.1) ← depends on mcp-use
155+
```
156+
157+
```bash
158+
# Apply the version changes
159+
pnpm version
160+
```
161+
162+
**This will:**
163+
1. Update `mcp-use/package.json` to `0.3.0`
164+
2. Update dependent packages (`@mcp-use/cli`, `@mcp-use/inspector`) with patch bumps
165+
3. Generate/update `CHANGELOG.md` in each package:
166+
167+
```markdown
168+
# mcp-use
169+
170+
## 0.3.0
171+
172+
### Minor Changes
173+
174+
- abc1234: Added useMcpTools React hook for easier tool management
175+
176+
## 0.2.0
177+
...
178+
```
179+
180+
4. Delete `.changeset/random-name-here.md`
181+
5. Update `pnpm-lock.yaml`
182+
183+
```bash
184+
# Review the changes
185+
git diff
186+
187+
# Commit the version changes
188+
git add .
189+
git commit -m "chore: version packages"
190+
git push origin main
191+
```
192+
193+
## Step 9: Publish to npm
194+
195+
```bash
196+
# Build everything
197+
pnpm build
198+
199+
# Publish to npm
200+
pnpm release
201+
```
202+
203+
**This will:**
204+
1. Build all packages with tsup
205+
2. Run `changeset publish`
206+
3. Publish `[email protected]` to npm
207+
4. Publish `@mcp-use/[email protected]` to npm
208+
5. Publish `@mcp-use/[email protected]` to npm
209+
6. Create git tags for each version
210+
211+
**Output:**
212+
```
213+
🦋 info npm info mcp-use
214+
🦋 info npm publish [email protected]
215+
🦋 success packages published successfully:
216+
217+
🦋 - @mcp-use/[email protected]
218+
🦋 - @mcp-use/[email protected]
219+
```
220+
221+
```bash
222+
# Push tags
223+
git push --follow-tags
224+
```
225+
226+
## Step 10: Verify Publication
227+
228+
```bash
229+
# Check on npm
230+
npm view mcp-use version
231+
# Output: 0.3.0
232+
233+
npm view @mcp-use/cli version
234+
# Output: 2.0.2
235+
236+
# Or visit:
237+
# https://www.npmjs.com/package/mcp-use
238+
# https://www.npmjs.com/package/@mcp-use/cli
239+
# https://www.npmjs.com/package/@mcp-use/inspector
240+
# https://www.npmjs.com/package/create-mcp-use-app
241+
```
242+
243+
## 📊 Timeline Summary
244+
245+
1. **Day 1**: Developer creates feature + changeset, pushes PR
246+
2. **Day 2-3**: Code review, changes, approval
247+
3. **Day 3**: PR merged to main
248+
4. **Day 3**: Maintainer runs `pnpm version` → Version PR created
249+
5. **Day 3**: Maintainer reviews and merges Version PR
250+
6. **Day 3**: Automated workflow publishes to npm
251+
7. **Done!**
252+
253+
## 🤖 Automated Workflow (GitHub Actions)
254+
255+
With the included GitHub Actions workflows:
256+
257+
1. **Developer** creates PR with changeset
258+
2. **CI** validates build, tests, lint
259+
3. **Merge** to main triggers release workflow
260+
4. **Changesets Action** creates "Version Packages" PR automatically
261+
5. **Maintainer** reviews and merges Version PR
262+
6. **Action** automatically publishes to npm
263+
7. **Done!** No manual commands needed
264+
265+
## 🎓 Learning Resources
266+
267+
- **Quick Reference**: See `CHANGESET_WORKFLOW.md`
268+
- **Detailed Guide**: See `VERSIONING.md`
269+
- **Changesets Docs**: https://github.com/changesets/changesets
270+
- **Semantic Versioning**: https://semver.org/
271+
272+
## 💡 Tips
273+
274+
- **Batch related changes** - Create one changeset for related changes across packages
275+
- **Clear summaries** - Write what users need to know, not implementation details
276+
- **Link to PRs** - Reference PR numbers in changeset summaries
277+
- **Test before release** - Always build and test before publishing
278+
- **Coordinate major bumps** - Plan breaking changes with the team
279+
280+
---
281+
282+
**Ready to get started?**
283+
284+
```bash
285+
# Make some changes, then:
286+
pnpm changeset
287+
```
288+

.changeset/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9+
10+
## Quick Start
11+
12+
### Creating a Changeset
13+
14+
```bash
15+
pnpm changeset
16+
```
17+
18+
This will prompt you to:
19+
1. Select which packages have changes
20+
2. Choose the version bump type (major/minor/patch)
21+
3. Write a summary of the changes
22+
23+
### Applying Changesets (Versioning)
24+
25+
```bash
26+
pnpm version
27+
```
28+
29+
This will:
30+
- Apply all pending changesets
31+
- Update package versions
32+
- Generate/update CHANGELOG.md files
33+
- Update dependencies
34+
35+
### Publishing to npm
36+
37+
```bash
38+
pnpm release
39+
```
40+
41+
This will:
42+
- Build all packages
43+
- Publish updated packages to npm
44+
- Create git tags
45+
46+
---
47+
48+
For detailed documentation, see [VERSIONING.md](../VERSIONING.md) in the project root.

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["test-ui"]
11+
}

.changeset/migrate-to-tsup.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"mcp-use": patch
3+
"@mcp-use/cli": patch
4+
"@mcp-use/inspector": patch
5+
"create-mcp-use-app": patch
6+
---
7+
8+
Migrated build system from tsc to tsup for faster builds (10-100x improvement) with dual CJS/ESM output support. This is an internal change that improves build performance without affecting the public API.
9+

0 commit comments

Comments
 (0)