Skip to content

Commit 9d5b993

Browse files
authored
Merge pull request #653 from semantic-release/beta
promote beta to stable
2 parents 7a2902e + e2f5d6c commit 9d5b993

6 files changed

+1408
-1939
lines changed

index.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { isUndefined } from "lodash-es";
2-
import { sync as parser } from "conventional-commits-parser";
3-
import filter from "conventional-commits-filter";
2+
import { CommitParser } from "conventional-commits-parser";
3+
import { filterRevertedCommitsSync } from "conventional-commits-filter";
44
import debugFactory from "debug";
55
import loadParserConfig from "./lib/load-parser-config.js";
66
import loadReleaseRules from "./lib/load-release-rules.js";
@@ -31,7 +31,8 @@ export async function analyzeCommits(pluginConfig, context) {
3131
const config = await loadParserConfig(pluginConfig, context);
3232
let releaseType = null;
3333

34-
filter(
34+
const parser = new CommitParser(config);
35+
const filteredCommits = filterRevertedCommitsSync(
3536
commits
3637
.filter(({ message, hash }) => {
3738
if (!message.trim()) {
@@ -41,8 +42,15 @@ export async function analyzeCommits(pluginConfig, context) {
4142

4243
return true;
4344
})
44-
.map(({ message, ...commitProps }) => ({ rawMsg: message, message, ...commitProps, ...parser(message, config) }))
45-
).every(({ rawMsg, ...commit }) => {
45+
.map(({ message, ...commitProps }) => ({
46+
rawMsg: message,
47+
message,
48+
...commitProps,
49+
...parser.parse(message),
50+
}))
51+
);
52+
53+
for (const { rawMsg, ...commit } of filteredCommits) {
4654
logger.log(`Analyzing commit: %s`, rawMsg);
4755
let commitReleaseType;
4856

@@ -71,11 +79,10 @@ export async function analyzeCommits(pluginConfig, context) {
7179

7280
// Break loop if releaseType is the highest
7381
if (releaseType === RELEASE_TYPES[0]) {
74-
return false;
82+
break;
7583
}
84+
}
7685

77-
return true;
78-
});
7986
logger.log("Analysis of %s commits complete: %s release", commits.length, releaseType || "no");
8087

8188
return releaseType;

lib/load-parser-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) =>
3030
loadedConfig = await conventionalChangelogAngular();
3131
}
3232

33-
return { ...loadedConfig.parserOpts, ...parserOpts };
33+
return { ...loadedConfig.parser, ...parserOpts };
3434
};

0 commit comments

Comments
 (0)