Skip to content

Commit 2bce0d3

Browse files
authoredMay 17, 2024··
feat: support latest conventional-changelog packages (#643)
BREAKING CHANGE: by supporting the latest major versions of conventional-changelog packages, we are dropping support for previous major versions of those packages due to the breaking changes between majors. this only impacts your project if you are installing alongside semantic-release, so updating those packages to latest version should be the only change you need for this update. no action should be necessary if you are using default semantic-release config
1 parent 990752b commit 2bce0d3

7 files changed

+233
-100
lines changed
 

‎index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { format } from "url";
22
import { find, merge } from "lodash-es";
33
import getStream from "get-stream";
44
import intoStream from "into-stream";
5-
import { sync as parser } from "conventional-commits-parser";
5+
import { CommitParser } from "conventional-commits-parser";
66
import writer from "./wrappers/conventional-changelog-writer.js";
7-
import filter from "conventional-commits-filter";
7+
import { filterRevertedCommitsSync } from "conventional-commits-filter";
88
import { readPackageUp } from "read-pkg-up";
99
import debugFactory from "debug";
1010
import loadChangelogConfig from "./lib/load-changelog-config.js";
@@ -43,7 +43,8 @@ export async function generateNotes(pluginConfig, context) {
4343

4444
const { issue, commit, referenceActions, issuePrefixes } =
4545
find(HOSTS_CONFIG, (conf) => conf.hostname === hostname) || HOSTS_CONFIG.default;
46-
const parsedCommits = filter(
46+
const parser = new CommitParser({ referenceActions, issuePrefixes, ...parserOpts });
47+
const parsedCommits = filterRevertedCommitsSync(
4748
commits
4849
.filter(({ message, hash }) => {
4950
if (!message.trim()) {
@@ -55,7 +56,7 @@ export async function generateNotes(pluginConfig, context) {
5556
})
5657
.map((rawCommit) => ({
5758
...rawCommit,
58-
...parser(rawCommit.message, { referenceActions, issuePrefixes, ...parserOpts }),
59+
...parser.parse(rawCommit.message),
5960
}))
6061
);
6162
const previousTag = lastRelease.gitTag || lastRelease.gitHead;

‎lib/load-changelog-config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default async ({ preset, config, parserOpts, writerOpts, presetConfig },
3333
}
3434

3535
return {
36-
parserOpts: { ...loadedConfig.parserOpts, ...parserOpts },
37-
writerOpts: { ...loadedConfig.writerOpts, ...writerOpts },
36+
parserOpts: { ...loadedConfig.parser, ...parserOpts },
37+
writerOpts: { ...loadedConfig.writer, ...writerOpts },
3838
};
3939
};

0 commit comments

Comments
 (0)
Please sign in to comment.