-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore version bump for non-conventional commits #22
Comments
The options provided to this plugin are sent to its underlying dependency: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump#readme However, at first glance I don't see an option for what you are trying to achieve. But maybe it's standard behavior? |
Right, my experience here was from using |
Did a little bit of digging and testing, and I can see the
Only when a |
As mentioned in release-it/release-it#798 by vonovak... This sounds like something that should be an optional flag for modifying the return types of I think that'd be a valid contribution if something along these lines doesn't already exist there. And, I'd also question how |
So there are a few options:
|
I'm not sure any of these options provide a really good solution... Implementing a To echo your sentiment:
Moving the Adding a hook to the CLI command puts all the onus on the user of this plugin and is subject to significant user error. Personally, I think this type of logic should really be a core feature in the Haven't had a chance to look, but, I'd be curious what library |
Totally agreed. Looks like |
Hello @webpro, I'm wondering, has this been fixed, or do you plan to fix it? |
Looking into it again, I'm seeing basically all presets for recommended bump work the same. Here's the angular preset: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/conventional-recommended-bump.js (this is the It always returns value However, I just released a small update of release-it (warning: it's only in the upcoming release-it v15), which together with a custom So, with release-it v15 and this plugin v5 this would allow something like this in module.exports = {
plugins: {
'@release-it/conventional-changelog': {
whatBump: commits => ({ level: null, reason: 'Parsed commits do not warrant a version bump.' })
}
}
}; Still, you would need to properly implement the (You could use this already using the |
@webpro How does your example code snippet leverage Are you suggesting that the function would be extended with additional conditional logic to properly determine when to set the |
My code example is only to indicate where the function fits in the release-it/plugin config. So yes, additional logic is required, much like the original (linked to above). |
Following up on this. I have created a whatBump that seems to align more with the intent of the angular preset and the semantic-release version. Here's the function: whatBump: (commits,options)=>{
let defaults = {
build: 'ignore',
ci: 'ignore',
docs: 'ignore',
feat: 'minor',
fix: 'patch',
perf: 'patch',
refactor: 'ignore',
test: 'ignore'
}
let types = (options?.preset?.types || [])
.reduce((a, v) => {
return { ...a, [v.type]: v.release}
}, {})
types = Object.assign({},defaults,types)
let breakings = 0
let features = 0
let levelSet = ['major','minor','patch','ignore']
let level = Math.min.apply(Math, commits.map(commit => {
let level = levelSet.indexOf(types[commit.type])
level = level<0?3:level
if (commit.notes.length > 0) {
breakings += commit.notes.length
}
if(commit.type === 'feat'){
features += 1;
}
return level
}))
return {
level: level,
reason: breakings === 1
? `There is ${breakings} BREAKING CHANGE and ${features} features`
: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
} You can then combine this with: "preset": {
"name": "conventionalcommits",
"types": [
{
"type": "refactor",
"release": "patch"
},
{
"type": "style",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "ci",
"release": "patch"
}
]
} This gives you the ability to override the specific types with one of |
I'm happy to make a PR if it's deemed appropriate. Possibly to the |
That would be nice, @jamesvillarrubia! Are you still up for this? Would be great to have options to ignore certain types of commits. |
Thanks for sharing! I might be wrong, but it doesn't look like the code does a major bump on |
Maybe the function can be extended; I'll be happy to add it to the docs or maybe even merge it into the codebase (with some logic/option to enable it). |
@webpro This function doesn't work for preRelease and null is ignored there. The . version is still being incremented. |
Hi, Someone has any new about this issue? Thank you. |
This is fixed in #102 |
In most conventions supported with
conventional-changelog
, there are commit types that should not trigger a version bump.For example, when using the
angular
orconventionalcommits
preset
, version bumps should only be applicable if using commits that begin withfix
,feat
, or other types that include a!
to signify aBREAKING CHANGE
.For commit messages that either do not conform to the types for the specified preset or are not one of the types listed above that signify a version change,
release-it
and this plugin should ignore the creation of a new semver release.Is this achievable by this plug-in, since it overrides the standard version bump logic that happens in
release-it
?The text was updated successfully, but these errors were encountered: