question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Streamline changeset generation with conventional commit support

See original GitHub issue

Affected Packages

@changesets/cli, perhaps a new package would be more appropriate for this functionality

Problem

Our organization has been versioning packages with lerna + conventional commits for a while now, but we are looking at moving towards changesets, mainly because the .changeset/config.json is just awesome. I love how you can make explicit associations between different packages - this is exactly what the conventional commits workflow has been missing imo.

Our developers have become accustomed to the conventional commit workflow and I think that providing an integration could go a long way in terms of facilitating adoption for other organizations as well.

Proposed solution

I am hoping something similar to the following would be possible.

Given some number of conventional commits since master n, and some arbitrary number of packages in a mono-repo, running changeset version should:

  1. Visit each of the n commits and determine the proper version bump based on the commit message and affected package. For example, if you have a commit that affects package A: feat: Add some feature to package A, the associated version bump should be translated to a minor bump of package A. Similarly if you have a commit to package B: fix: Fix something, the associated version bump should be translated to a patch bump of package B.

  2. Once the version bumps from conventional commits are determined, pre-populate the changeset version prompts with the respective bumps. In the example above with package A, when the prompt asks Which packages should have a minor bump?, package A should already be pre-selected. I would also see this pre-populating the prompt. Please enter a summary for this change (this will be in the changelogs).

I would also hope for a flag that would allow us to auto-generate the changesets from conventional commits (without any additional prompting). That being said, I can see how this specifically may be at odds with the generally recommended changeset workflow.

I am new to changesets, so I am currently unfamiliar with how it is set up, or how much of a shift this would be. Hoping I can get an idea of whether this something that others would find valuable, and/or what changes might be necessary to facilitate this. I am happy to help out however possible with this effort. Alternatively, if there is any sort of plugin-based API for third-party integrations, that may be more appropriate for this use case, but I am unaware of such an API.

Cheers!

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:18
  • Comments:9

github_iconTop GitHub Comments

2reactions
oncetcommented, Aug 19, 2022

dup of #577

If I understand correctly, #577 is about the format of the PR message and what OP is looking for is something more similar to sementic release. I.e. having Changesets to automatically determine if bump should be major, minor or patch.

1reaction
sangdthcommented, Nov 11, 2022

@william-will-angi I think you should apply that rule per project, because the package B could have a wrapper layer around package A to prevent the breaking changes, thus the breaking change from A still make minor effect on B, that’s why I don’t think the framework would make it by default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A specification for structured commit messages | Hacker News
10 years of Conventional Commits experience required. ... The machine-readable part is useful for generating changelogs (eg. broken out by ...
Read more >
Tooling for Conventional Commits
change: A tool for generating and updating a changelog using Conventional Commits. Turbogit: A command line tool to help you follow Conventional Commits...
Read more >
conventional-commits-parser - npm
Parse raw conventional commits. Latest version: 3.2.4, last published: a year ago. Start using conventional-commits-parser in your project ...
Read more >
Committer's Guide | FreeBSD Documentation Portal
Introductory information for FreeBSD committers.
Read more >
gitchangelog · PyPI
Use your commit log to make beautifull and configurable changelog file. ... support full or incremental changelog generation to match your needs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found