conventional-commits-parser
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -6,2 +6,3 @@ #!/usr/bin/env node | ||
var meow = require('meow'); | ||
var split = require('split'); | ||
@@ -27,8 +28,7 @@ var cli = meow({ | ||
}) | ||
.pipe(split(cli.input[1] || '\n\n\n')) | ||
.pipe(conventionalCommitsParser(cli.flags)) | ||
.pipe(JSONStream.stringify()) | ||
.pipe(process.stdout); | ||
} | ||
else { | ||
} else { | ||
var commit = ''; | ||
@@ -35,0 +35,0 @@ var through = require('through2'); |
@@ -39,4 +39,3 @@ 'use strict'; | ||
cb(null, commit); | ||
} | ||
else { | ||
} else { | ||
cb(); | ||
@@ -43,0 +42,0 @@ } |
@@ -25,4 +25,3 @@ 'use strict'; | ||
lines.shift(); | ||
} | ||
else { | ||
} else { | ||
lines.splice(0, 2); | ||
@@ -68,3 +67,3 @@ } | ||
issue = i.match(reDigit); | ||
if(issue) { | ||
if (issue) { | ||
msg.closes.push(parseInt(issue[0], 10)); | ||
@@ -71,0 +70,0 @@ } |
{ | ||
"name": "conventional-commits-parser", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "parse raw conventional commits", | ||
@@ -23,2 +23,3 @@ "homepage": "https://github.com/stevemao/conventional-commits-parser", | ||
"meow": "^3.1.0", | ||
"split": "^0.3.3", | ||
"through2": "^0.6.3" | ||
@@ -25,0 +26,0 @@ }, |
@@ -42,2 +42,3 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverall-image]][coverall-url] | ||
## Install | ||
@@ -206,3 +207,35 @@ | ||
Commits should be split by at least three newlines (`\n\n\n`) or you can specify a separator as the second argument. | ||
Eg: in log2.txt | ||
```text | ||
2d0eda10e43f6b079b531c507282fad082ea0762 | ||
docs(ngMessageExp): split ngMessage docs up to show its alias more clearly | ||
=== | ||
4374f892c6fa4af6ba1f2ed47c5f888fdb5fadc5 | ||
fix($animate): applyStyles from options on leave | ||
Closes #10068 | ||
``` | ||
And you run | ||
```sh | ||
conventional-commits-parser log2.txt '===' | ||
``` | ||
```sh | ||
[ | ||
{"hash":"2d0eda10e43f6b079b531c507282fad082ea0762","header":"docs(ngMessageExp): split ngMessage docs up to show its alias more clearly","body":"","footer":"","breaks":{},"closes":[],"type":"docs","scope":"ngMessageExp","subject":"split ngMessage docs up to show its alias more clearly"} | ||
, | ||
{"hash":"4374f892c6fa4af6ba1f2ed47c5f888fdb5fadc5","header":"fix($animate): applyStyles from options on leave","body":"","footer":"Closes #10068","breaks":{},"closes":[10068],"type":"fix","scope":"$animate","subject":"applyStyles from options on leave"} | ||
] | ||
``` | ||
Will be printed out. | ||
## License | ||
@@ -209,0 +242,0 @@ |
@@ -36,2 +36,3 @@ 'use strict'; | ||
}); | ||
stream.end(); | ||
@@ -44,3 +45,3 @@ var length = commits.length; | ||
expect(chunk.hash).to.equal('13f31602f396bc269076ab4d389cfd8ca94b20ba'); | ||
if(--length === 0) { | ||
if (--length === 0) { | ||
done(); | ||
@@ -70,2 +71,3 @@ } | ||
}); | ||
stream.end(); | ||
@@ -80,8 +82,6 @@ var i = 0; | ||
cb(); | ||
}, function() { | ||
expect(i).to.equal(2); | ||
done(); | ||
})); | ||
setTimeout(function() { | ||
expect(i).to.equal(2); | ||
done(); | ||
}, 500); | ||
}); | ||
@@ -106,2 +106,3 @@ | ||
}); | ||
stream.end(); | ||
@@ -118,5 +119,3 @@ var length = commits.length; | ||
expect(chunk.closes).to.eql([123, 33]); | ||
} | ||
else { | ||
} else { | ||
expect(chunk.breaks['BREAKING CHANGES']).to.equal('some breaking changes'); | ||
@@ -123,0 +122,0 @@ done(); |
@@ -22,13 +22,2 @@ 'use strict'; | ||
var shortSubjectOptions = { | ||
maxSubjectLength: 10, | ||
headerPattern: /^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/, | ||
closeKeywords: [ | ||
'close', | ||
], | ||
breakKeywords: [ | ||
'BREAKING CHANGE' | ||
] | ||
}; | ||
var msg = parser( | ||
@@ -91,3 +80,6 @@ '9b1aff905b638aa274a5fc8f88662df446d374bd\n' + | ||
it('should trim if subject is too long', function() { | ||
var msg = parser('feat(ng-list): Allow custom separator', shortSubjectOptions); | ||
var msg = parser('feat(ng-list): Allow custom separator', { | ||
maxSubjectLength: 10, | ||
headerPattern: /^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/ | ||
}); | ||
expect(msg.subject).to.equal('Allow cust'); | ||
@@ -102,2 +94,9 @@ }); | ||
}); | ||
it('should allow ":" in scope', function() { | ||
var msg = parser('feat(ng:list): Allow custom separator', { | ||
headerPattern: /^(\w*)(?:\(([:\w\$\.\-\* ]*)\))?\: (.*)$/, | ||
}); | ||
expect(msg.scope).to.equal('ng:list'); | ||
}); | ||
}); | ||
@@ -104,0 +103,0 @@ |
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
22932
252
5
415
+ Addedsplit@^0.3.3
+ Addedsplit@0.3.3(transitive)