Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Implement Changesets for Version Management ✅

Successfully implemented changesets for version management in the Egg.js monorepo, addressing the issue request to avoid bulk releases of all packages.

✅ All Tasks Completed

  • Research and understand changesets workflow
  • Install @changesets/cli as a dev dependency
  • Initialize changesets configuration
  • Create .changeset directory with config.json
  • Add changeset scripts to root package.json
  • Create GitHub workflow for changesets automation
  • Add comprehensive documentation (English & Chinese)
  • Update both README files with changeset information
  • Test configuration and commands
  • Verify linting passes
  • Use npm trusted publishing (removed NODE_AUTH_TOKEN)
  • Revert unintended file extension changes in package.json files

📦 What Was Changed

1. Changeset Infrastructure

  • Added @changesets/cli dependency (catalog managed)
  • Configured .changeset/config.json for the monorepo
  • Base branch: next, Access: public
  • Ignored example apps and site from versioning

2. NPM Scripts (package.json)

pnpm changeset                 # Create new changeset
pnpm run changeset:version     # Version packages
pnpm run changeset:publish     # Build & publish

3. GitHub Actions Workflow

  • .github/workflows/changesets.yml automates releases
  • Creates "Version Packages" PR on push to next
  • Auto-publishes when Version Packages PR is merged
  • Uses npm trusted publishing with provenance (no NODE_AUTH_TOKEN needed)
  • Includes cnpm sync step

4. Documentation

  • docs/changeset-guide.md (English, 5KB)
  • docs/changeset-guide.zh-CN.md (Chinese, 4.5KB)
  • Updated README.md and README.zh-CN.md
  • Comprehensive guides covering:
    • Basic workflow
    • Advanced usage (snapshots, prereleases)
    • Best practices
    • Troubleshooting
    • Migration strategy

5. Workspace Configuration

  • Updated pnpm-workspace.yaml to exclude problematic packages from minimumReleaseAge
  • Added: @changesets/*, rolldown-plugin-dts, obug, unrun

🎯 Key Benefits

Selective Publishing: Only changed packages are versioned and published
Automatic Changelogs: Generated from changeset summaries per package
Better Tracking: Clear documentation of what changed and why
PR-Based Workflow: Review version changes before publishing
Backward Compatible: Old scripts/version.js remains for compatibility
Bilingual Documentation: Complete guides in English and Chinese
Secure Publishing: Uses npm trusted publishing with provenance

🔄 How It Works

  1. Developer makes changes and runs pnpm changeset
  2. Interactive prompt asks which packages changed and version bump type
  3. Commit the changeset file with code changes
  4. Merge to next branch triggers GitHub Actions
  5. GitHub Actions creates "Version Packages" PR with updated versions
  6. Review & merge Version Packages PR
  7. Auto-publish to npm with provenance attestation using trusted publishing

🚀 Migration Strategy

The old version scripts (scripts/version.js) are kept for:

  • Backward compatibility
  • Emergency use cases
  • Gradual team migration

Going forward, changesets should be the primary method for version management.

✅ Quality Checks

  • All new files created successfully
  • Linting passed (no new warnings introduced)
  • Configuration validated
  • Documentation complete in both languages
  • No breaking changes to existing workflows
  • Uses npm trusted publishing (no manual token needed)
  • Reverted unintended file extension changes (.js to .mjs, .d.ts to .d.mts)

📚 References


This PR implements the complete changeset infrastructure. The workflow will be fully functional once merged to the next branch.

Original prompt

This section details on the original issue you should resolve

<issue_title>use changesets 去管理版本发布</issue_title>
<issue_description>https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md
这样可以避免一下全量发布所有版本
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 13, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: f42437f
Status: ✅  Deploy successful!
Preview URL: https://4f21dab1.egg-v3.pages.dev
Branch Preview URL: https://copilot-use-changesets-for-v.egg-v3.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 13, 2025

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: f42437f
Status: ✅  Deploy successful!
Preview URL: https://1405e82a.egg-cci.pages.dev
Branch Preview URL: https://copilot-use-changesets-for-v.egg-cci.pages.dev

View logs

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Changesets Release' step
Uses Step: changesets
uses 'changesets/action' with ref 'v1', not a pinned commit hash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot pinned commit hash

Copilot AI changed the title [WIP] Use changesets to manage version releases feat: implement changesets for selective package versioning Nov 13, 2025
Copilot AI requested a review from fengmk2 November 13, 2025 11:03
Copilot finished work on behalf of fengmk2 November 13, 2025 11:03
@socket-security
Copy link

socket-security bot commented Nov 13, 2025

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.43%. Comparing base (b5485c2) to head (630ee97).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5691      +/-   ##
==========================================
+ Coverage   85.40%   85.43%   +0.02%     
==========================================
  Files         561      561              
  Lines       10931    10931              
  Branches     1238     1238              
==========================================
+ Hits         9336     9339       +3     
+ Misses       1496     1493       -3     
  Partials       99       99              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

"types": "./dist/index.d.ts"
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot don't change the file name extension, for all!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted all package.json files to their original state. The file extension changes (.js to .mjs, .d.ts to .d.mts) were unintended side effects from pnpm install and have been removed. Fixed in f42437f.

Copilot AI requested a review from fengmk2 November 13, 2025 14:36
Copilot finished work on behalf of fengmk2 November 13, 2025 14:36
Copilot finished work on behalf of fengmk2 November 13, 2025 14:44
Copilot finished work on behalf of fengmk2 November 13, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use changesets 去管理版本发布

2 participants