conventional-changelog-writer
Advanced tools
Comparing version 0.0.18 to 0.1.0
12
index.js
@@ -49,3 +49,3 @@ 'use strict'; | ||
hash: function(hash) { | ||
if (typeof hash === 'string') { | ||
if (_.isString(hash)) { | ||
return hash.substring(0, 7); | ||
@@ -58,3 +58,3 @@ } | ||
version: function(version) { | ||
if (typeof version === 'string') { | ||
if (_.isString(version)) { | ||
return version.replace(/^[v=]/i, ''); | ||
@@ -74,6 +74,10 @@ } | ||
var generateOn = options.generateOn; | ||
if (typeof generateOn === 'string') { | ||
if (_.isString(generateOn)) { | ||
generateOn = function(chunk) { | ||
return chunk[options.generateOn]; | ||
return !_.isUndefined(chunk[options.generateOn]); | ||
}; | ||
} else if (!_.isFunction(generateOn)) { | ||
generateOn = function() { | ||
return false; | ||
}; | ||
} | ||
@@ -80,0 +84,0 @@ |
{ | ||
"name": "conventional-changelog-writer", | ||
"version": "0.0.18", | ||
"version": "0.1.0", | ||
"description": "Write logs based on conventional commits and templates", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/stevemao/conventional-changelog-writer", |
@@ -191,6 +191,8 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
Type: `function` or `string` Default: if `commit.version` is a valid semver. | ||
Type: `function`, `string` or `any` Default: if `commit.version` is a valid semver. | ||
When the upstream finishes pouring the commits it will generate a block of logs by default. However, you can generate more than one block based on this criteria (usually a version) even if there are still commits from the upstream. **NOTE**: It checks on the transformed commit chunk instead of the original one (you can check on the original by access the `raw` object on the `commit`). However, if the transformed commit is ignored it falls back to the original commit. | ||
If this value is a `string`, it checks the existence of the field. Set to other type to disable it. | ||
##### reverse | ||
@@ -197,0 +199,0 @@ |
@@ -360,2 +360,22 @@ 'use strict'; | ||
it('`generateOn` could be a null', function(done) { | ||
var i = 0; | ||
getStream() | ||
.pipe(conventionalChangelogWriter({}, { | ||
generateOn: null | ||
})) | ||
.pipe(through(function(chunk, enc, cb) { | ||
chunk = chunk.toString(); | ||
expect(chunk).to.include('<a name=""></a>\n# (' + today); | ||
i++; | ||
cb(null); | ||
}, function() { | ||
expect(i).to.equal(1); | ||
done(); | ||
})); | ||
}); | ||
it('version should fall back on `context.version` and `context.date`', function(done) { | ||
@@ -362,0 +382,0 @@ var i = 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
72425
1795
328