Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

conventional-changelog-writer

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conventional-changelog-writer - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

3

index.js

@@ -36,2 +36,5 @@ 'use strict';

},
finalizeContext: function(context) {
return context;
},
reverse: false,

@@ -38,0 +41,0 @@ includeDetails: false,

12

lib/util.js

@@ -159,13 +159,15 @@ 'use strict';

var mergedContext = _.merge({}, context, keyCommit, getExtraContext(commits, notes, options));
context = _.merge({}, context, keyCommit, getExtraContext(commits, notes, options));
if (keyCommit && keyCommit.committerDate) {
mergedContext.date = keyCommit.committerDate;
context.date = keyCommit.committerDate;
}
if (mergedContext.version) {
mergedContext.isPatch = context.isPatch || semver.patch(mergedContext.version) !== 0;
if (context.version) {
context.isPatch = context.isPatch || semver.patch(context.version) !== 0;
}
return compiled(mergedContext);
context = options.finalizeContext(context, options, commits, keyCommit);
return compiled(context);
}

@@ -172,0 +174,0 @@

{
"name": "conventional-changelog-writer",
"version": "0.2.1",
"version": "0.3.0",
"description": "Write logs based on conventional commits and templates",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/stevemao/conventional-changelog-writer",

@@ -197,2 +197,24 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url]

##### finalizeContext
Type: `function` Default: pass through
###### finalizeContext(context, options, commits, keyCommit)
####### context
The generated context based on original input `context` and `options`.
####### options
Normalized options.
####### commits
Filtered commits from your git metadata.
####### keyCommit
The commit that triggers to generate the log.
##### reverse

@@ -255,3 +277,3 @@

Basically you can make your own templates and define all your template variables. This module can iterate the commits and compile them. 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.

@@ -258,0 +280,0 @@

@@ -548,3 +548,6 @@ 'use strict';

var log = util.generate({
mainTemplate: '{{whatever}}'
mainTemplate: '{{whatever}}',
finalizeContext: function(context) {
return context;
}
}, [], {

@@ -561,3 +564,6 @@ whatever: 'a'

var log = util.generate({
mainTemplate: '{{whatever}}'
mainTemplate: '{{whatever}}',
finalizeContext: function(context) {
return context;
}
}, [], [], {

@@ -573,3 +579,6 @@ whatever: '`a`'

mainTemplate: '{{#each commitGroups}}{{commits.length}}{{#each commits}}{{header}}{{/each}}{{/each}}{{#each noteGroups}}{{title}}{{#each notes}}{{this}}{{/each}}{{/each}}',
ignoreReverted: true
ignoreReverted: true,
finalizeContext: function(context) {
return context;
}
}, [{

@@ -637,3 +646,17 @@ header: 'revert: feat(): amazing new module\n',

});
it('should finalize context', function() {
var log = util.generate({
mainTemplate: '{{whatever}} {{somethingExtra}}',
finalizeContext: function(context) {
context.somethingExtra = 'oh';
return context;
}
}, [], [], {
whatever: '`a`'
});
expect(log).to.equal('`a` oh');
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc