commit-stream
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -0,1 +1,8 @@ | ||
## [2.1.0](https://github.com/rvagg/commit-stream/compare/v2.0.1...v2.1.0) (2023-05-16) | ||
### Features | ||
* add support for green-button merges ([9e87160](https://github.com/rvagg/commit-stream/commit/9e87160f261d67ea0a3a6c4a02136b5c50ecfa42)) | ||
## [2.0.1](https://github.com/rvagg/commit-stream/compare/v2.0.0...v2.0.1) (2023-04-04) | ||
@@ -2,0 +9,0 @@ |
@@ -49,3 +49,3 @@ import through2 from 'through2' | ||
commit.reviewers.push({ name: m[1], email: m[2] }) | ||
} else if ((m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/)) !== null) { | ||
} else if ((m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/) || line.match(/\(#(\d+)\)$/)) !== null) { | ||
commit.prUrl = m[1] | ||
@@ -70,2 +70,5 @@ if ( | ||
} | ||
if ((m = line.match(/^ {4}(.*)\s\(#\d+\)$/)) && !commit.summary) { | ||
commit.summary = m[1] | ||
} | ||
} else if (/^ {4}/.test(line) && (line = line.trim()).length !== 0) { | ||
@@ -72,0 +75,0 @@ if (commit.summary === undefined || commit.summary === null) { |
{ | ||
"name": "commit-stream", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Turn a `git log` into a stream of commit objects", | ||
@@ -5,0 +5,0 @@ "main": "commit-stream.js", |
@@ -50,3 +50,3 @@ # commit-stream | ||
- `prUrl`: a URL pointing to a pull-request where this change was made if the commit metadata contains a `PR-URL: https://github.com/user/project/pull/XX` line. Note that whatever proceeds the `PR-URL: ` string will be collected in this property; one exception being that if a shortened `#XX` version is found and you have supplied `defaultGitHubUser` and `defaultGitHubProject` arguments to the constructor then a full GitHub pull-request will be reconstituted in its place. | ||
- `ghUser`, `ghProject`, `ghIssue`: if a proper GitHub pull request is found for the `prUrl` property (including shortened `#XX` ones), these properties will be added to point to the original user, project and issue (pull-request) for this change, as extracted from the URL. | ||
- `ghUser`, `ghProject`, `ghIssue`: if a proper GitHub pull request is found for the `prUrl` property (including shortened `#XX` ones), these properties will be added to point to the original user, project and issue (pull-request) for this change, as extracted from the URL. Also, if a commit message line ends with ` (#XX)` as is done with green-button merges, this will be used. | ||
@@ -53,0 +53,0 @@ ## License |
31
test.js
@@ -9,3 +9,8 @@ import commitStream from './commit-stream.js' | ||
function gitToList (t, gitCmd, callback) { | ||
function gitToList (t, gitCmd, user, repo, callback) { | ||
if (typeof user === 'function') { | ||
callback = user | ||
user = undefined | ||
repo = undefined | ||
} | ||
const child = spawn('bash', ['-c', gitCmd]) | ||
@@ -25,3 +30,3 @@ child.stderr.pipe(bl((_, out) => { | ||
split2(), | ||
commitStream(), | ||
commitStream(user, repo), | ||
listStream.obj(callback), | ||
@@ -202,1 +207,23 @@ () => {} | ||
}) | ||
test('current commit log with ghUser and ghRepo passed', function (t) { | ||
gitToList(t, 'git log', 'rvagg', 'commit-stream', function (err, list) { | ||
t.error(err, 'no error') | ||
t.ok(list && list.length > 1, 'got a list') | ||
t.deepEqual(list[list.length - 18], { | ||
sha: 'b23208796d7e3fd08b36f6106aa7f027aa827137', | ||
authors: [ | ||
{ name: 'Rich Trott', email: 'rtrott@gmail.com' } | ||
], | ||
authorDate: 'Mon Oct 11 19:29:18 2021 -0700', | ||
prUrl: 'https://github.com/rvagg/commit-stream/pull/5', | ||
ghIssue: 5, | ||
ghUser: 'rvagg', | ||
ghProject: 'commit-stream', | ||
author: { name: 'Rich Trott', email: 'rtrott@gmail.com' }, | ||
summary: 'chore: update strip-ansi to 6.x' | ||
}, 'got correct pr url for green-button merge') | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20690
312