Claude Code के साथ Changeset Version Management Implement करना
Claude Code से Changeset-based version management और automatic CHANGELOG generation implement करना सीखें। Monorepo support, CI integration, और release flow design cover किया गया है।
Changeset से Systematic Version Management
Changeset package version management और CHANGELOG generation automate करने वाला tool है। Especially monorepo environment में powerful है, packages के बीच dependencies consider करके consistent release flow बनाया जा सकता है। Claude Code setup से CI integration तक accurately support करता है।
Initial Setup
Claude Code से setup request करें।
> Changeset को monorepo project में introduce करो।
> GitHub Actions से automatic release, CHANGELOG generation include करो।
# Install
npm install -D @changesets/cli @changesets/changelog-github
# Initialize
npx changeset init
// .changeset/config.json
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "your-org/your-repo" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
Changeset बनाना
Changes describe करने वाली Changeset file बनाने का तरीका।
# Interactively Changeset बनाएं
npx changeset
<!-- .changeset/happy-dogs-fly.md -->
---
"@myapp/ui": minor
"@myapp/utils": patch
---
Button component में "outline" variant add किया।
Utility functions की type definitions improve कीं।
Claude Code को Changeset creation request करने का prompt example:
> इस change के लिए Changeset बनाओ।
> @myapp/ui में minor version change, description भी लिखो।
npm scripts Configuration
// package.json
{
"scripts": {
"changeset": "changeset",
"changeset:status": "changeset status",
"version": "changeset version",
"release": "changeset publish",
"prerelease": "npm run build"
}
}
GitHub Actions से Automatic Release
PR merge पर automatically version up PR create करने और merge के बाद npm पर publish करने वाला workflow।
# .github/workflows/release.yml
name: Release
on:
push:
branches: [main]
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
pull-requests: write
packages: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: npm run version
publish: npm run release
title: "chore: version up"
commit: "chore: version up"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Monorepo Advanced Settings
Packages के बीच coordination manage करने की setting patterns।
// .changeset/config.json
{
"changelog": [
"@changesets/changelog-github",
{ "repo": "your-org/your-repo" }
],
"commit": false,
"fixed": [
["@myapp/core", "@myapp/cli"]
],
"linked": [
["@myapp/ui", "@myapp/theme"]
],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
- fixed - हमेशा same version रहने वाले package groups
- linked - Version linked होकर बढ़ने वाले package groups
Pre-release Management
Beta और RC releases का flow।
# Pre-release mode में enter करें
npx changeset pre enter beta
# Changeset add करें
npx changeset
# Pre-release version apply करें
npx changeset version
# => 1.0.0 -> 1.1.0-beta.0
# Publish करें
npx changeset publish
# Pre-release mode exit करें
npx changeset pre exit
Changeset Validation
PR में Changeset included है या नहीं CI से check करने वाला workflow।
# .github/workflows/changeset-check.yml
name: Changeset Check
on:
pull_request:
branches: [main]
jobs:
changeset-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Check for changeset
run: npx changeset status --since=origin/main
Custom CHANGELOG Format
CHANGELOG output customize करने का pattern।
// .changeset/changelog-config.ts
import type { ChangelogFunctions } from "@changesets/types";
const changelogFunctions: ChangelogFunctions = {
getDependencyReleaseLine: async () => "",
getReleaseLine: async (changeset, type) => {
const [firstLine, ...rest] = changeset.summary
.split("\n")
.map((l) => l.trimEnd());
const date = new Date().toISOString().slice(0, 10);
let returnVal = `- ${firstLine}`;
if (rest.length > 0) {
returnVal += `\n${rest.map((l) => ` ${l}`).join("\n")}`;
}
return returnVal;
},
};
export default changelogFunctions;
Summary
Changeset systematic version management और release flow automate करने के लिए powerful tool है। Claude Code का उपयोग करके initial setup से CI integration, monorepo support तक efficiently बनाया जा सकता है।
Monorepo management methods के लिए Monorepo Management Guide देखें, CI/CD pipeline design के लिए CI/CD Setup Guide देखें। Changesets Official Documentation भी check करें।
Related Posts
Claude Code Hooks में Mastery: Auto-Format, Auto-Test, और बहुत कुछ
Claude Code hooks से auto-formatting और auto-testing setup करना सीखें। Practical configuration examples और real-world use cases शामिल हैं।
Claude Code MCP Server Setup और Practical Use Cases
Claude Code की MCP server capabilities की comprehensive guide। External tools connect करना, servers configure करना, और real-world integration examples सीखें।
CLAUDE.md लिखने की Complete Guide: Project Configuration की Best Practices
Effective CLAUDE.md files लिखने की thorough guide। अपना tech stack, conventions, और project structure communicate करना सीखें और Claude Code की output quality maximize करें।