Skip to content
This repository has been archived by the owner on Feb 5, 2018. It is now read-only.

feat(mergeConfig): add defaultFinalizeContext #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/merge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function mergeConfig(options, context, gitRawCommitsOpts, parserOpts, writerOpts
}

writerOpts = _.assign({
finalizeContext: function(context, writerOpts, filteredCommits, keyCommit, originalCommits) {
defaultFinalizeContext: function(context, writerOpts, filteredCommits, keyCommit, originalCommits) {
var firstCommit = originalCommits[0];
var lastCommit = originalCommits[originalCommits.length - 1];
var firstCommitHash = firstCommit ? firstCommit.hash : null;
Expand Down Expand Up @@ -264,6 +264,9 @@ function mergeConfig(options, context, gitRawCommitsOpts, parserOpts, writerOpts
}

return context;
},
finalizeContext: function() {
return this.defaultFinalizeContext.apply(this, arguments);
}
},
config.writerOpts, {
Expand Down
12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,17 @@ See the [conventional-changelog-writer](https://github.com/conventional-changelo

Finalize context is used for generating above context.

**NOTE:** If you overwrite this value the above context defaults will be gone.
**NOTE:** If you overwrite this value the above context defaults will be gone. If you want to modify the result based on the default function, you could do:

```js
finalizeContext: function() {
var newContext = this.defaultFinalizeContext.apply(this, arguments);

// Modify newContext

return newContext;
}
```

##### reverse

Expand Down