conventional-recommended-bump 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/cli.mjs +7 -12
- package/index.js +34 -51
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -38,11 +38,11 @@ npm install conventional-recommended-bump
|
|
|
38
38
|
```javascript
|
|
39
39
|
const conventionalRecommendedBump = require(`conventional-recommended-bump`);
|
|
40
40
|
|
|
41
|
-
conventionalRecommendedBump({
|
|
41
|
+
const recommendation = await conventionalRecommendedBump({
|
|
42
42
|
preset: `angular`
|
|
43
|
-
}, (error, recommendation) => {
|
|
44
|
-
console.log(recommendation.releaseType); // 'major'
|
|
45
43
|
});
|
|
44
|
+
|
|
45
|
+
console.log(recommendation.releaseType); // 'major'
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
```bash
|
package/cli.mjs
CHANGED
|
@@ -93,17 +93,12 @@ if (flags.verbose) {
|
|
|
93
93
|
options.warn = console.warn.bind(console)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
conventionalRecommendedBump(options, flags
|
|
97
|
-
if (err) {
|
|
98
|
-
console.error(err.toString())
|
|
99
|
-
process.exit(1)
|
|
100
|
-
}
|
|
96
|
+
const data = await conventionalRecommendedBump(options, flags)
|
|
101
97
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
if (data.releaseType) {
|
|
99
|
+
console.log(data.releaseType)
|
|
100
|
+
}
|
|
105
101
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})
|
|
102
|
+
if (flags.verbose && data.reason) {
|
|
103
|
+
console.log(`Reason: ${data.reason}`)
|
|
104
|
+
}
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
const concat = require('concat-stream')
|
|
3
2
|
const conventionalCommitsFilter = require('conventional-commits-filter')
|
|
4
3
|
const conventionalCommitsParser = require('conventional-commits-parser')
|
|
5
4
|
const { loadPreset } = require('conventional-changelog-preset-loader')
|
|
@@ -8,7 +7,7 @@ const gitRawCommits = require('git-raw-commits')
|
|
|
8
7
|
|
|
9
8
|
const VERSIONS = ['major', 'minor', 'patch']
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
function noop () {}
|
|
12
11
|
|
|
13
12
|
async function conventionalRecommendedBump (optionsArgument, parserOptsArgument) {
|
|
14
13
|
if (typeof optionsArgument !== 'object') {
|
|
@@ -45,59 +44,43 @@ async function conventionalRecommendedBump (optionsArgument, parserOptsArgument)
|
|
|
45
44
|
parserOptsArgument)
|
|
46
45
|
|
|
47
46
|
const warn = typeof parserOpts.warn === 'function' ? parserOpts.warn : noop
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
skipUnstable: options.skipUnstable,
|
|
55
|
-
cwd: options.cwd
|
|
56
|
-
}, (err, tags) => {
|
|
57
|
-
if (err) {
|
|
58
|
-
return reject(err)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
gitRawCommits({
|
|
62
|
-
format: '%B%n-hash-%n%H',
|
|
63
|
-
from: tags[0] || '',
|
|
64
|
-
path: options.path,
|
|
65
|
-
...options.gitRawCommitsOpts
|
|
66
|
-
}, {
|
|
67
|
-
cwd: options.cwd
|
|
68
|
-
})
|
|
69
|
-
.pipe(conventionalCommitsParser(parserOpts))
|
|
70
|
-
.pipe(concat(data => {
|
|
71
|
-
const commits = options.ignoreReverted ? conventionalCommitsFilter(data) : data
|
|
72
|
-
|
|
73
|
-
if (!commits || !commits.length) {
|
|
74
|
-
warn('No commits since last release')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let result = whatBump(commits, options)
|
|
78
|
-
|
|
79
|
-
if (result && result.level != null) {
|
|
80
|
-
result.releaseType = VERSIONS[result.level]
|
|
81
|
-
} else if (result == null) {
|
|
82
|
-
result = {}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
resolve(result)
|
|
86
|
-
}))
|
|
87
|
-
})
|
|
47
|
+
const tags = await gitSemverTags({
|
|
48
|
+
lernaTags: !!options.lernaPackage,
|
|
49
|
+
package: options.lernaPackage,
|
|
50
|
+
tagPrefix: options.tagPrefix,
|
|
51
|
+
skipUnstable: options.skipUnstable,
|
|
52
|
+
cwd: options.cwd
|
|
88
53
|
})
|
|
89
|
-
|
|
54
|
+
const commitsStream = gitRawCommits({
|
|
55
|
+
format: '%B%n-hash-%n%H',
|
|
56
|
+
from: tags[0] || '',
|
|
57
|
+
path: options.path,
|
|
58
|
+
...options.gitRawCommitsOpts
|
|
59
|
+
}, {
|
|
60
|
+
cwd: options.cwd
|
|
61
|
+
})
|
|
62
|
+
.pipe(conventionalCommitsParser(parserOpts))
|
|
63
|
+
let commits = []
|
|
64
|
+
|
|
65
|
+
for await (const commit of commitsStream) {
|
|
66
|
+
commits.push(commit)
|
|
67
|
+
}
|
|
90
68
|
|
|
91
|
-
|
|
92
|
-
const cb = typeof parserOptsArgument === 'function' ? parserOptsArgument : cbArgument
|
|
69
|
+
commits = options.ignoreReverted ? conventionalCommitsFilter(commits) : commits
|
|
93
70
|
|
|
94
|
-
if (
|
|
95
|
-
|
|
71
|
+
if (!commits || !commits.length) {
|
|
72
|
+
warn('No commits since last release')
|
|
96
73
|
}
|
|
97
74
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
75
|
+
let result = whatBump(commits, options)
|
|
76
|
+
|
|
77
|
+
if (result && result.level != null) {
|
|
78
|
+
result.releaseType = VERSIONS[result.level]
|
|
79
|
+
} else if (result == null) {
|
|
80
|
+
result = {}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return result
|
|
101
84
|
}
|
|
102
85
|
|
|
103
|
-
|
|
86
|
+
module.exports = conventionalRecommendedBump
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conventional-recommended-bump",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Get a recommended version bump based on conventional commits",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/conventional-changelog/conventional-changelog/issues"
|
|
@@ -30,16 +30,15 @@
|
|
|
30
30
|
"bump"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"concat-stream": "^2.0.0",
|
|
34
33
|
"meow": "^12.0.1",
|
|
35
|
-
"conventional-changelog-preset-loader": "^4.
|
|
34
|
+
"conventional-changelog-preset-loader": "^4.1.0",
|
|
36
35
|
"conventional-commits-filter": "^4.0.0",
|
|
37
36
|
"conventional-commits-parser": "^5.0.0",
|
|
38
37
|
"git-raw-commits": "^4.0.0",
|
|
39
|
-
"git-semver-tags": "^
|
|
38
|
+
"git-semver-tags": "^7.0.0"
|
|
40
39
|
},
|
|
41
40
|
"bin": "cli.mjs",
|
|
42
41
|
"devDependencies": {
|
|
43
|
-
"conventional-changelog-conventionalcommits": "^7.0.
|
|
42
|
+
"conventional-changelog-conventionalcommits": "^7.0.2"
|
|
44
43
|
}
|
|
45
44
|
}
|