yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.42k stars 1.11k forks source link

[Feature] "Cherry-pick" PRs by semver bump #2071

Open arcanis opened 4 years ago

arcanis commented 4 years ago

Describe the user story

As a package releaser, I'd like to be able to merge all features into master (regardless of whether they are patch, minor, or major), but still be able to release some of them without the others. Right now, I can only deploy everything or nothing at all, which prevents merging major changes unless we commit into publishing a major release as the next one.

Describe the solution you'd like

I'd like a command called yarn versions fork which would print a list of all the PRs currently in "prepare" mode. I'd be able to select a few of them before Yarn would automatically apply them on top of a new branch started from the last release commit in the history. They would be released, then merged back into master. This way, I would only have released a few PRs without having to care too much about the breaking changes.

Describe the drawbacks of your solution

It's simple when described like this, but there are various levels of subtleties that need to be considered:

andreialecu commented 4 years ago

One thing that makes this difficult with the current workflow is that everything is merged to master and not develop first.

Other projects have a develop branch on which things are merged and on which work happens, and when it's time to release, things can be cherry picked back onto master.

This would make it easy to pick what should be released even with the current workflow.

arcanis commented 4 years ago

That wouldn't help much - I've already made releases by making a release branch and cherry-picking there, this part isn't too difficult. The problem is manual cherry-picking, which requires to know which commits can be cherry-picked to match semver constraints. When you merge a certain amount of PRs per week, it becomes impractical to remember which are patches vs minors vs majors. The workflow described in this PR would print them all on the CLI and would tell you what would be the semver effects of adding a package into a release.

andreialecu commented 4 years ago

@arcanis here's something that should help in the interim:

cd .yarn/versions
grep -Rl "minor" . | xargs -n1 git log --pretty=oneline --abbrev-commit -- | cat