Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-conventional-commits

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-conventional-commits - npm Package Compare versions

Comparing version 1.3.0 to 1.4.1

4

lib/commands/config.js

@@ -30,3 +30,3 @@ const fs = require("fs");

changelogConfig.commitTypes = changelogOverride.commitTypes || changelogConfig.commitTypes;
changelogConfig.includeInvalidCommits = changelogOverride.includeInvalidCommits !== undefined
changelogConfig.includeInvalidCommits = changelogOverride.includeInvalidCommits !== undefined
? changelogOverride.includeInvalidCommits === true

@@ -77,3 +77,3 @@ : changelogConfig.includeInvalidCommits;

// regex patterns
config.convention.msgRegex = /^(?<type>\w+)(?:\((?<scope>[^()]+)\))?:\s*(?<subject>.+)/i;
config.convention.msgRegex = /^(?<type>\w+)(?:\((?<scope>[^()]+)\))?(?<breaking>!)?:\s*(?<description>.+)/i;
config.convention.msgMergeRegex = /^Merge branch +["'](?<branch>.+)['"]/i;

@@ -80,0 +80,0 @@ config.convention.msgRevertRegex = /^Revert +["'](?<subject>.+)['"]/i;

@@ -45,17 +45,13 @@ const Git = require("./git");

// ------determine version bump ---------------------------------------
const changes = {
breaking: 0,
feature: 0,
patch: 0
};
(await getCommitLog()).forEach(commit => {
if (commit.breakingChanges && commit.breakingChanges.length) {
changes.breaking++;
} else if (convention.featureCommitTypes.includes(commit.type)) {
changes.feature++;
} else {
changes.patch++;
}
});
const changes = (await getCommitLog()).reduce((acc, commit) => {
if (commit.breakingChanges && commit.breakingChanges.length) {
acc.breaking++;
} else if (convention.featureCommitTypes.includes(commit.type)) {
acc.feature++;
} else {
acc.patch++;
}
return acc;
}, {breaking: 0, feature: 0, patch: 0}); // TODO rename to breakingChanges, features and patches

@@ -77,4 +73,9 @@ applyChangesToVersion(version, changes);

// parse breaking changes
conventionalCommit.breakingChanges = !commit.body ? [] : commit.body.split(/^BREAKING CHANGES?: */im).splice(1);
conventionalCommit.breakingChanges = commit.body ? commit.body.split(/^BREAKING CHANGES?: */im).splice(1) : [];
if(conventionalSubject.breaking && !conventionalCommit.breakingChanges.length) {
conventionalCommit.breakingChanges = [conventionalSubject.description]
}
delete conventionalCommit.breaking;
// parse issue ids

@@ -87,3 +88,3 @@ conventionalCommit.relatedIssues = [commit.subject, commit.body].join("\n\n").match(convention.issueRegex()) || [];

function parseCommitSubject(commit) {
const subject = commit.subject;
const subject = commit.description;
let conventionalSubject;

@@ -95,3 +96,4 @@ const msgMatch = subject.match(convention.msgRegex);

scope: msgMatch.groups.scope === '' ? undefined : msgMatch.groups.scope,
subject: msgMatch.groups.subject
breaking: msgMatch.groups.breaking === '!',
description: msgMatch.groups.subject
}

@@ -103,3 +105,3 @@ } else {

type: 'merge',
subject: msgMergeMatch.groups.branch
description: msgMergeMatch.groups.branch
};

@@ -111,3 +113,3 @@ } else {

...commit,
subject: msgRevertMatch.groups.subject
description: msgRevertMatch.groups.description
});

@@ -118,3 +120,3 @@ conventionalSubject.revert = !conventionalSubject.revert; // negate revert of revert commit

conventionalSubject = {
subject: subject
description: subject
};

@@ -121,0 +123,0 @@ }

{
"name": "git-conventional-commits",
"version": "1.3.0",
"version": "1.4.1",
"description": "git conventional commits util",

@@ -13,3 +13,2 @@ "licence": "GPLv3",

"author": "",
"license": "ISC",
"dependencies": {

@@ -19,3 +18,3 @@ "yargs": "^17.3.1"

"devDependencies": {
"jest": "^27.5.1",
"jest": "^28.1.3",
"tmp-promise": "^3.0.3"

@@ -22,0 +21,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc