Skip to content

Commit

Permalink
refactor: Make whatBump's value conventional
Browse files Browse the repository at this point in the history
  • Loading branch information
oluwatobiss committed Oct 28, 2024
1 parent a11f57f commit 2b9ccd2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ for the configuration object to pass as `preset`.
- This option will be passed as the first argument to
[`bumper.bump`](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-recommended-bump/README.md#api)
- [Type definition for `whatBump` → look for `Preset['whatBump']`](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-recommended-bump/src/types.ts)
- Use the `"undefined"` string value to skip releasing a new version.
- Use the `false` Boolean value to skip releasing a new version.

```json
{
"plugins": {
"@release-it/conventional-changelog": {
"whatBump": "undefined"
"whatBump": false
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class ConventionalChangelog extends Plugin {
if (options.commitsOpts) bumper.commits(options.commitsOpts, options.parserOpts);

async function getWhatBump() {
if (options.whatBump === 'undefined') {
return () => ({ releaseType: undefined });
if (options.whatBump === false) {
return () => ({ releaseType: null });
} else {
const bumperPreset = await bumper.preset;

Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ test('should not bump when recommended bump returns null', async () => {
}
});

test('should not bump when whatBump === "undefined"', async () => {
test('should not bump when whatBump === false', async () => {
setup();
sh.exec(`git tag 1.0.0`);
add('fix', 'bar');
add('feat', 'baz');
{
const options = getOptions({ whatBump: 'undefined' });
const options = getOptions({ whatBump: false });
const { version } = await runTasks(...options);
assert.equal(version, undefined);
}
Expand Down

0 comments on commit 2b9ccd2

Please sign in to comment.