Skip to content

Commit

Permalink
Merge pull request #653 from semantic-release/beta
Browse files Browse the repository at this point in the history
promote beta to stable
  • Loading branch information
travi committed May 31, 2024
2 parents 7a2902e + e2f5d6c commit 9d5b993
Show file tree
Hide file tree
Showing 6 changed files with 1,408 additions and 1,939 deletions.
23 changes: 15 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isUndefined } from "lodash-es";
import { sync as parser } from "conventional-commits-parser";
import filter from "conventional-commits-filter";
import { CommitParser } from "conventional-commits-parser";
import { filterRevertedCommitsSync } from "conventional-commits-filter";
import debugFactory from "debug";
import loadParserConfig from "./lib/load-parser-config.js";
import loadReleaseRules from "./lib/load-release-rules.js";
Expand Down Expand Up @@ -31,7 +31,8 @@ export async function analyzeCommits(pluginConfig, context) {
const config = await loadParserConfig(pluginConfig, context);
let releaseType = null;

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

return true;
})
.map(({ message, ...commitProps }) => ({ rawMsg: message, message, ...commitProps, ...parser(message, config) }))
).every(({ rawMsg, ...commit }) => {
.map(({ message, ...commitProps }) => ({
rawMsg: message,
message,
...commitProps,
...parser.parse(message),
}))
);

for (const { rawMsg, ...commit } of filteredCommits) {
logger.log(`Analyzing commit: %s`, rawMsg);
let commitReleaseType;

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

// Break loop if releaseType is the highest
if (releaseType === RELEASE_TYPES[0]) {
return false;
break;
}
}

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

return releaseType;
Expand Down
2 changes: 1 addition & 1 deletion lib/load-parser-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) =>
loadedConfig = await conventionalChangelogAngular();
}

return { ...loadedConfig.parserOpts, ...parserOpts };
return { ...loadedConfig.parser, ...parserOpts };
};
Loading

0 comments on commit 9d5b993

Please sign in to comment.