-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: introduce changeset for monorepo version management #12783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EurFelux
wants to merge
1
commit into
main
Choose a base branch
from
build/monorepo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,324
−1,510
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Changesets | ||
|
|
||
| This folder contains configuration and changeset files for managing package versioning and publishing in the Cherry Studio monorepo. | ||
|
|
||
| ## What is Changesets? | ||
|
|
||
| Changesets is a tool to help manage versioning and publishing for multi-package repositories. It tracks changes to packages and automates: | ||
|
|
||
| - Version bumping based on semantic versioning | ||
| - Changelog generation | ||
| - Package publishing | ||
| - Dependency updates between packages | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Adding a changeset | ||
|
|
||
| When you make changes that should be published, run: | ||
|
|
||
| ```bash | ||
| pnpm changeset add | ||
| ``` | ||
|
|
||
| This will: | ||
| 1. Ask which packages have changed | ||
| 2. Ask for the type of change (patch/minor/major) | ||
| 3. Ask for a description of the change | ||
| 4. Create a changeset file in `.changeset/` | ||
|
|
||
| ### Versioning packages | ||
|
|
||
| When ready to release: | ||
|
|
||
| ```bash | ||
| pnpm changeset version | ||
| ``` | ||
|
|
||
| This will: | ||
| 1. Bump package versions based on accumulated changesets | ||
| 2. Update CHANGELOG.md files | ||
| 3. Update internal dependencies | ||
| 4. Delete consumed changeset files | ||
|
|
||
| ### Publishing packages | ||
|
|
||
| ```bash | ||
| pnpm release:packages | ||
| ``` | ||
|
|
||
| This will: | ||
| 1. Build all packages | ||
| 2. Publish to npm | ||
| 3. Create GitHub releases | ||
|
|
||
| ## Configuration | ||
|
|
||
| See `config.json` for the changeset configuration: | ||
|
|
||
| - **changelog**: Uses `@changesets/changelog-github` to generate GitHub-linked changelogs | ||
| - **access**: `public` - packages are published publicly | ||
| - **baseBranch**: `main` - PRs target this branch | ||
| - **updateInternalDependencies**: `patch` - internal deps are updated on any change | ||
| - **ignore**: Packages not for publishing (shared, mcp-trace, ui) | ||
|
|
||
| ## Packages managed | ||
|
|
||
| | Package | Current Version | Description | | ||
| |---------|----------------|-------------| | ||
| | `@cherrystudio/ai-core` | 1.0.9 | Unified AI Provider Interface | | ||
| | `@cherrystudio/ai-sdk-provider` | 0.1.3 | AI SDK provider bundle with CherryIN routing | | ||
| | `@cherrystudio/extension-table-plus` | 3.0.11 | Table extension for Tiptap | | ||
|
|
||
| ## Dependency relationships | ||
|
|
||
| ``` | ||
| ai-core (peer-depends on) → ai-sdk-provider | ||
| ``` | ||
|
|
||
| Changeset automatically handles updating peer dependency ranges when `ai-sdk-provider` is published. | ||
|
|
||
| ## CI/CD Integration | ||
|
|
||
| The `.github/workflows/release-packages.yml` workflow automatically: | ||
|
|
||
| 1. Creates a "Version Packages" PR when changesets are merged to main | ||
| 2. Publishes packages when the Version Packages PR is merged | ||
| 3. Creates GitHub releases with changelogs | ||
|
|
||
| ## Learn more | ||
|
|
||
| - [Changesets documentation](https://github.com/changesets/changesets) | ||
| - [Common questions](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json", | ||
| "changelog": ["@changesets/changelog-github", { "repo": "CherryHQ/cherry-studio" }], | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [], | ||
| "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { | ||
| "onlyUpdatePeerDependentsWhenOutOfRange": true | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@cherrystudio/ai-core': patch | ||
| '@cherrystudio/ai-sdk-provider': patch | ||
| '@cherrystudio/extension-table-plus': patch | ||
| --- | ||
|
|
||
| Initial changeset setup - no functional changes | ||
|
|
||
| This changeset marks the initial setup of the changeset workflow for the Cherry Studio monorepo. | ||
| No functional changes are included in this release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Release Packages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - '.changeset/**' | ||
| - 'packages/**' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release Packages | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Get pnpm store directory | ||
| id: pnpm-cache | ||
| shell: bash | ||
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Cache pnpm dependencies | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm- | ||
|
|
||
| - name: Install Dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build Packages | ||
| run: pnpm build:packages | ||
|
|
||
| - name: Create Release Pull Request or Publish to npm | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| publish: pnpm changeset:publish | ||
| version: pnpm changeset:version | ||
| commit: 'chore: version packages' | ||
| title: 'chore: version packages' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Publish Summary | ||
| if: steps.changesets.outputs.published == 'true' | ||
| run: | | ||
| echo "## Published Packages" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "The following packages were published:" >> $GITHUB_STEP_SUMMARY | ||
| echo "$PUBLISHED_PACKAGES" >> $GITHUB_STEP_SUMMARY | ||
| env: | ||
| PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Snapshot Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to create snapshot from' | ||
| required: true | ||
| default: 'main' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| snapshot: | ||
| name: Snapshot Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.inputs.branch }} | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Get pnpm store directory | ||
| id: pnpm-cache | ||
| shell: bash | ||
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Cache pnpm dependencies | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm- | ||
|
|
||
| - name: Install Dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build Packages | ||
| run: pnpm build:packages | ||
|
|
||
| - name: Version Snapshot | ||
| run: pnpm changeset version --snapshot snapshot | ||
|
|
||
| - name: Publish Snapshot | ||
| run: pnpm changeset publish --tag snapshot --no-git-tag | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Snapshot Summary | ||
| run: | | ||
| echo "## Snapshot Release" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "Snapshot released from branch: $BRANCH" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "Install with:" >> $GITHUB_STEP_SUMMARY | ||
| echo '```bash' >> $GITHUB_STEP_SUMMARY | ||
| echo 'pnpm add @cherrystudio/ai-core@snapshot' >> $GITHUB_STEP_SUMMARY | ||
| echo 'pnpm add @cherrystudio/ai-sdk-provider@snapshot' >> $GITHUB_STEP_SUMMARY | ||
| echo 'pnpm add @cherrystudio/extension-table-plus@snapshot' >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| env: | ||
| BRANCH: ${{ github.event.inputs.branch }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,13 @@ | |
| "release:aicore:alpha": "pnpm --filter @cherrystudio/ai-core version prerelease --preid alpha && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --tag alpha --access public", | ||
| "release:aicore:beta": "pnpm --filter @cherrystudio/ai-core version prerelease --preid beta && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --tag beta --access public", | ||
| "release:aicore": "pnpm --filter @cherrystudio/ai-core version patch && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --access public", | ||
| "release:ai-sdk-provider": "pnpm --filter @cherrystudio/ai-sdk-provider version patch && pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-sdk-provider publish --access public" | ||
| "release:ai-sdk-provider": "pnpm --filter @cherrystudio/ai-sdk-provider version patch && pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-sdk-provider publish --access public", | ||
| "changeset": "changeset", | ||
| "changeset:status": "changeset status", | ||
| "changeset:version": "changeset version", | ||
| "changeset:publish": "changeset publish", | ||
| "build:packages": "pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/extension-table-plus build", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里建议修改成为:packages:build, packages:release |
||
| "release:packages": "pnpm build:packages && changeset publish" | ||
| }, | ||
| "dependencies": { | ||
| "@anthropic-ai/claude-agent-sdk": "0.1.76", | ||
|
|
@@ -117,6 +123,8 @@ | |
| "@aws-sdk/client-bedrock-runtime": "^3.910.0", | ||
| "@aws-sdk/client-s3": "^3.910.0", | ||
| "@biomejs/biome": "2.2.4", | ||
| "@changesets/changelog-github": "^0.5.2", | ||
| "@changesets/cli": "^2.29.8", | ||
| "@cherrystudio/ai-core": "workspace:^1.0.9", | ||
| "@cherrystudio/embedjs": "0.1.31", | ||
| "@cherrystudio/embedjs-interfaces": "0.1.31", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.