Using Changesets in a polyglot monorepo
4 hours ago
- #changesets
- #monorepo
- #versioning
- Monorepos offer advantages for small-to-medium teams, such as enabling atomic changes across the system in a single commit, which reduces compatibility and integration issues.
- Changesets is a viable tool for managing versioning in polyglot monorepos, even with its primary focus on JavaScript/TypeScript, by leveraging custom scripts via its GitHub Action for polyglot support.
- Setting up changesets involves using proxy package.json files for all packages to handle version bumps, with configuration files like .changeset/config.json to control behavior such as private package tagging.
- Automated releases can be implemented using a GitHub workflow that calls custom scripts (e.g., just version) to sync versions from package.json to native manifests (e.g., Cargo.toml, pyproject.toml) for different programming languages.
- Instead of relying on on.push.tags triggers, which can be unreliable in GitHub, use workflow_call to react to package tags for building artifacts like Docker images, ensuring consistent and reliable automation.