File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed
Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -27,20 +27,13 @@ const diff = (version1, version2) => {
2727 return 'major'
2828 }
2929
30- // Otherwise it can be determined by checking the high version
31-
32- if ( highVersion . minor ) {
33- // anything higher than a minor bump would result in the wrong version
34- return 'minor'
35- }
36-
37- if ( highVersion . patch ) {
38- // anything higher than a patch bump would result in the wrong version
30+ // If the main part has no difference
31+ if ( lowVersion . compareMain ( highVersion ) === 0 ) {
32+ if ( lowVersion . minor && ! lowVersion . patch ) {
33+ return 'minor'
34+ }
3935 return 'patch'
4036 }
41-
42- // bumping major/minor/patch all have same result
43- return 'major'
4437 }
4538
4639 // add the `pre` prefix if we are going to a prerelease version
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ test('diff versions test', (t) => {
3535 [ '1.0.0-1' , '1.1.0-1' , 'preminor' ] ,
3636 [ '1.0.0-1' , '1.0.1-1' , 'prepatch' ] ,
3737 [ '1.7.2-1' , '1.8.1' , 'minor' ] ,
38+ [ '1.1.1-pre' , '2.1.1-pre' , 'premajor' ] ,
39+ [ '1.1.1-pre' , '2.1.1' , 'major' ] ,
40+ [ '1.2.3-1' , '1.2.3' , 'patch' ] ,
41+ [ '1.4.0-1' , '2.3.5' , 'major' ] ,
42+ [ '1.6.1-5' , '1.7.2' , 'minor' ] ,
43+ [ '2.0.0-1' , '2.1.1' , 'major' ] ,
3844 ] . forEach ( ( v ) => {
3945 const version1 = v [ 0 ]
4046 const version2 = v [ 1 ]
You can’t perform that action at this time.
0 commit comments