File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed
packages/release-it-config Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change
1
+ const customWhatBump = require ( './bumper' ) ;
2
+
1
3
module . exports = {
2
4
plugins : {
3
- " @release-it/conventional-changelog" : {
4
- preset : " angular" ,
5
- infile : " CHANGELOG.md" ,
5
+ ' @release-it/conventional-changelog' : {
6
+ preset : ' angular' ,
7
+ infile : ' CHANGELOG.md' ,
6
8
gitRawCommitsOpts : {
7
9
path : '.' ,
8
10
from : process . env . RELEASE_SCM_BASE ,
@@ -11,14 +13,15 @@ module.exports = {
11
13
path : '.' ,
12
14
from : process . env . RELEASE_SCM_BASE ,
13
15
} ,
16
+ whatBump : customWhatBump
14
17
}
15
18
} ,
16
19
git : {
17
20
tag : false , // We want the last version to be derived from the package.json version field.
18
21
commitsPath : '.' , // Only consider commits in this folder and not the whole repository.
19
22
requireCommits : true , // Do not do anything with git if there are no commits.
20
23
requireCommitsFail : false , // Do not fail if there are no commits.
21
- commitMessage : " chore(release): released version v${version} [no ci]" ,
24
+ commitMessage : ' chore(release): released version v${version} [no ci]' ,
22
25
} ,
23
26
npm : {
24
27
publish : false
Original file line number Diff line number Diff line change
1
+ module . exports = function whatBump ( commits ) {
2
+ let level = - 1 //default to be non-existence level.
3
+ let breakings = 0
4
+ let features = 0
5
+
6
+ commits . forEach ( commit => {
7
+ if ( commit . notes . length > 0 ) {
8
+ breakings += commit . notes . length
9
+ level = 0
10
+ } else if ( commit . type === 'feat' ) {
11
+ features += 1
12
+ if ( level !== 0 ) { // only change if there is no breaking change already
13
+ level = 1
14
+ }
15
+ } else if ( commit . type ) { //any other type
16
+ level = 2
17
+ }
18
+ } )
19
+
20
+ return {
21
+ level,
22
+ reason : breakings === 1
23
+ ? `There is ${ breakings } BREAKING CHANGE and ${ features } features`
24
+ : `There are ${ breakings } BREAKING CHANGES and ${ features } features`
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments