semver icon indicating copy to clipboard operation
semver copied to clipboard

Popping new versions when there is only commits that do not trigger new version generation

Open dianjuar opened this issue 4 years ago • 8 comments

Semver is popping a fix version when there is nothing "new". All the new commits are chore, docs, build and ci but still Semver creates a new fix version. The changelog generated is empty.

You can see it on your own project's versions

image

dianjuar avatar Nov 03 '21 05:11 dianjuar

Hi @dianjuar, thanks for raising the issue. In fact, the default bump when anything is changed is a "patch" which makes sense as changing the docs or restructuring some code for instance should trigger a bump and a new release.

The default behavior of the Angular changelog preset is to only show feat, fix and perf as mentioned here https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#type

We have to override the behavior when generating the changelog here: https://github.com/jscutlery/semver/blob/main/packages/semver/src/executors/version/utils/changelog.ts

Do you want to help with a PR?

yjaaidi avatar Nov 03 '21 10:11 yjaaidi

Actually, there is a weird behavior in conventional-changelog-angular where other type of commits are discarded from the changelog if they don't have notes:

https://github.com/conventional-changelog/conventional-changelog/blob/840d139c40a2c4e773794d794c34bc4dbfde27c2/packages/conventional-changelog-angular/writer-opts.js#L28-L58

yjaaidi avatar Nov 03 '21 10:11 yjaaidi

Cf. https://github.com/conventional-changelog/conventional-changelog/issues/696

We could either suggest a PR that allows overriding the behavior by passing some options through the context, or we could simply wrap the angular preset with a custom angular preset that overrides the current behavior.

yjaaidi avatar Nov 03 '21 11:11 yjaaidi

Note that chore type is no more allowed in conventional-changelog-angular nor @commitlint/config-angular, cf: see the list.

edbzn avatar Nov 04 '21 13:11 edbzn

I ran into an issue that I feel is related to this issue, which I brought up in a discussion: https://github.com/jscutlery/semver/discussions/385. Essentially, if the first command in the following has an expected version bump, then each of the subsequent commands will result in patch versions, without any changes:

nx proj-a version --versionTagPrefix 'proj-a-alpha-' 
nx proj-a version --versionTagPrefix 'proj-a-'
nx proj-a version --versionTagPrefix 'proj-a-alpha-'
nx proj-a version --versionTagPrefix 'proj-a-'

CaffeinatedCodeMonkey avatar Nov 17 '21 14:11 CaffeinatedCodeMonkey

Was there a workaround for this? I see you can use --skipCommitTypes but when specifying that like --skipCommitTypes=chore, it seems to still generate a new version even if there's only a chore commit.

zeroregard avatar Jun 10 '22 09:06 zeroregard

@zeroregard It's a bug if --skipCommitTypes is not taken into account.

edbzn avatar Jun 10 '22 09:06 edbzn

I noticed that it worked fine if I wrote commit messages like chore(versioning): this is a test but if I wrote it like chore: this is a test, it would not take --skipCommitTypes into account

zeroregard avatar Jun 10 '22 09:06 zeroregard