conventional-changelog-writer
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -0,1 +1,11 @@ | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/conventional-changelog/conventional-changelog-writer/compare/v1.1.1...v1.2.0) (2016-04-17) | ||
### Features | ||
* **transform:** also pass context as an arg ([9bd984c](https://github.com/conventional-changelog/conventional-changelog-writer/commit/9bd984c)) | ||
<a name="1.1.1"></a> | ||
@@ -2,0 +12,0 @@ ## [1.1.1](https://github.com/stevemao/conventional-changelog-writer/compare/v1.1.0...v1.1.1) (2016-02-29) |
@@ -86,3 +86,3 @@ 'use strict'; | ||
var result; | ||
var commit = util.processCommit(chunk, options.transform); | ||
var commit = util.processCommit(chunk, options.transform, context); | ||
var keyCommit = commit || chunk; | ||
@@ -89,0 +89,0 @@ |
@@ -99,3 +99,3 @@ 'use strict'; | ||
function processCommit(chunk, transform) { | ||
function processCommit(chunk, transform, context) { | ||
var commit; | ||
@@ -110,3 +110,3 @@ | ||
if (_.isFunction(transform)) { | ||
commit = transform(commit); | ||
commit = transform(commit, context); | ||
@@ -113,0 +113,0 @@ if (commit) { |
{ | ||
"name": "conventional-changelog-writer", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Write logs based on conventional commits and templates", | ||
"homepage": "https://github.com/stevemao/conventional-changelog-writer", | ||
"homepage": "https://github.com/conventional-changelog/conventional-changelog-writer", | ||
"author": { | ||
@@ -11,3 +11,3 @@ "name": "Steve Mao", | ||
}, | ||
"repository": "stevemao/conventional-changelog-writer", | ||
"repository": "conventional-changelog/conventional-changelog-writer", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"istanbul": "^0.4.2", | ||
"jscs": "^2.1.1", | ||
"jscs": "^3.0.3", | ||
"jshint": "^2.9.1-rc3", | ||
@@ -43,0 +43,0 @@ "mocha": "*" |
@@ -221,2 +221,4 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
Last chance to modify your context before generating a changelog. | ||
###### finalizeContext(context, options, commits, keyCommit) | ||
@@ -297,3 +299,3 @@ | ||
Variables in upstream are commit specific and should be used per commit. Eg: *commit date* and *commit username*. You can think of them as "local" or "isolate" variables. A "raw" commit message (original commit poured from upstream) is attached to `commit`. | ||
Variables in upstream are commit specific and should be used per commit. Eg: *commit date* and *commit username*. You can think of them as "local" or "isolate" variables. A "raw" commit message (original commit poured from upstream) is attached to `commit`. `transform` can be used to modify a commit. | ||
@@ -304,3 +306,3 @@ ### context | ||
Basically you can make your own templates and define all your template context. Extra context are based on commits from upstream and `options`. For more details, please checkout [handlebars](http://handlebarsjs.com) and the source code of this module. | ||
Basically you can make your own templates and define all your template context. Extra context are based on commits from upstream and `options`. For more details, please checkout [handlebars](http://handlebarsjs.com) and the source code of this module. `finalizeContext` can be used at last to modify context before generating a changelog. | ||
@@ -356,7 +358,7 @@ | ||
[npm-url]: https://npmjs.org/package/conventional-changelog-writer | ||
[travis-image]: https://travis-ci.org/stevemao/conventional-changelog-writer.svg?branch=master | ||
[travis-url]: https://travis-ci.org/stevemao/conventional-changelog-writer | ||
[daviddm-image]: https://david-dm.org/stevemao/conventional-changelog-writer.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/stevemao/conventional-changelog-writer | ||
[coveralls-image]: https://coveralls.io/repos/stevemao/conventional-changelog-writer/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/stevemao/conventional-changelog-writer | ||
[travis-image]: https://travis-ci.org/conventional-changelog/conventional-changelog-writer.svg?branch=master | ||
[travis-url]: https://travis-ci.org/conventional-changelog/conventional-changelog-writer | ||
[daviddm-image]: https://david-dm.org/conventional-changelog/conventional-changelog-writer.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/conventional-changelog/conventional-changelog-writer | ||
[coveralls-image]: https://coveralls.io/repos/conventional-changelog/conventional-changelog-writer/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/conventional-changelog/conventional-changelog-writer |
@@ -150,18 +150,18 @@ 'use strict'; | ||
describe('transform', function() { | ||
it('should ignore the field if it doesn\'t exist', function(done) { | ||
it('should transform the commit with context', function(done) { | ||
var i = 0; | ||
var upstream = through.obj(); | ||
upstream.write({ | ||
header: 'bla', | ||
body: null, | ||
footer: null, | ||
notes: [] | ||
}); | ||
upstream.end(); | ||
upstream | ||
.pipe(conventionalChangelogWriter()) | ||
getStream() | ||
.pipe(conventionalChangelogWriter({}, { | ||
transform: function(commit, context) { | ||
expect(context).to.eql({ | ||
commit: 'commits', | ||
issue: 'issues', | ||
date: today | ||
}); | ||
return commit; | ||
} | ||
})) | ||
.pipe(through(function(chunk, enc, cb) { | ||
expect(chunk.toString()).to.equal('<a name=""></a>\n# (' + today + ')\n\n* bla \n\n\n\n'); | ||
i++; | ||
@@ -844,2 +844,26 @@ cb(null); | ||
it('should ignore the field if it doesn\'t exist', function(done) { | ||
var i = 0; | ||
var upstream = through.obj(); | ||
upstream.write({ | ||
header: 'bla', | ||
body: null, | ||
footer: null, | ||
notes: [] | ||
}); | ||
upstream.end(); | ||
upstream | ||
.pipe(conventionalChangelogWriter()) | ||
.pipe(through(function(chunk, enc, cb) { | ||
expect(chunk.toString()).to.equal('<a name=""></a>\n# (' + today + ')\n\n* bla \n\n\n\n'); | ||
i++; | ||
cb(null); | ||
}, function() { | ||
expect(i).to.equal(1); | ||
done(); | ||
})); | ||
}); | ||
it('should sort notes on `text` by default', function(done) { | ||
@@ -846,0 +870,0 @@ var upstream = through.obj(); |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
96190
2416
361