Introduction
conventional-recommended-bump inspects the commits since your last release and recommends whether the next version should be a major, minor, or patch — following a preset’s rules (a breaking change → major, a new feature → minor, otherwise patch). It decides how much to bump; pair it with conventional-changelog to write the notes.
Quick start
Section titled “Quick start”-
Install
conventional-recommended-bumptogether with a preset:pnpm add -D conventional-recommended-bump conventional-changelog-conventionalcommitsnpm i -D conventional-recommended-bump conventional-changelog-conventionalcommitsyarn add -D conventional-recommended-bump conventional-changelog-conventionalcommits -
Make commits following the convention as you work:
feat(api): add async write() generatorfix(cli): resolve config path relative to cwd -
Run it with your preset. The recommended release type is printed to stdout:
pnpm conventional-recommended-bump -p conventionalcommitsnpx conventional-recommended-bump -p conventionalcommitsyarn conventional-recommended-bump -p conventionalcommits -
Get the recommended bump. A
featis present, so the change is a minor:minorAdd
--verbose(-v) to also print the reasoning:minorReason: There are 0 BREAKING CHANGES and 1 features
How the bump is decided
Section titled “How the bump is decided”The rules come from the preset. For Conventional Commits (and Angular):
| Commits since the last release | Recommended bump |
|---|---|
Any breaking change (! or a BREAKING CHANGE: footer) | major |
At least one feat | minor |
Otherwise (fix, perf, …) | patch |
If nothing warrants a release, no bump is printed. The preMajor option softens these rules for projects still on 0.x.
Use it in a release script
Section titled “Use it in a release script”Feed the result straight into npm version:
npm version "$(npx conventional-recommended-bump -p conventionalcommits)"Programmatic usage
Section titled “Programmatic usage”The same recommendation is available through the Bumper class:
import { Bumper } from 'conventional-recommended-bump'
const bumper = new Bumper() .loadPreset('conventionalcommits')
const { releaseType, reason } = await bumper.bump()
console.log(releaseType) // 'minor'See the JS API page for the full builder interface.