Closed stevemao closed 6 years ago
In fact, it should be the other way. transform
can be used for any kind of things and other options make it easier.
Link https://github.com/conventional-changelog/conventional-changelog-core/pull/4
The API should probably look something like expressjs's middleware, promise or stream pipe where you can do something else based on the previous work.
Maybe we could make transform
and finalizeContext
an array. For each existing option, say groupBy
, could be made into a single function. and by default, there are a few functions in the array.
compose
seems to be a good fit here.
@bcoe @nexdrew I need some suggestions here. I'm quite happy with the api of conventional-commits-parser. This one seems a bit tricky.
For starters, and also considering the way for example conventional-changelog-angular
works is that upon transform it will first filter and then rewrite/transform existing commits.
How about splitting the filtering and the transformation into two distinct functions, e.g.
writerOpts : {
filter : function (commit) {...},
transform : function (commit) {...}
}
The transform function will then only receive the commits returned by the filter and must then process all of the commits it receives. The filter on the other hand will only return a commit when it needs to be included in the changelog. That way, one can simply override the filter function... provided that the transform function will be adjusted as well.
Of course, one could think of passing additional options to the filter or even the transform function.
@silkentrance This will still have exactly the same problem. I believe an array can completely solve this.
I also struggled with this and finally found the reason why this is happening:
Looks like there is no way to tell the parser to include all types of changes into the markdown, unless overwriting the whole transform
function.
Related discussion: https://github.com/conventional-changelog/conventional-changelog-angular/issues/13
It's a bit of a pity that there is currently no way to pass an option to Angular's transform
and thus get a custom set of types in your changelog. I know that this is sort of against Angular's convention, but it can be still useful. E.g. a complete changelog can be attached to repos's tags or exported somewhere else. IMO there should even be an option to include unclassified commits for those who want this.
We're closing this issue out as this repository has been merged into our conventional-changelog
mono-repository.
If you would like to see this change incorporated into conventional-changelog
please consider re-opening the issue against the conventional-changelog
mono-repository.
Edit: TBH not too many people would config the API and they usually just use the default one or a preset. But if they do, they only change a small part. I believe an array of functions should solve this.