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.1.0 to 1.2.0

lib/execAsync.js

1

git-conventional-commits.default.json

@@ -29,2 +29,3 @@ {

],
"includeInvalidCommits": true,
"commitIgnoreRegexPattern": "^WIP ",

@@ -31,0 +32,0 @@ "headlines": {

6

lib/commands/commandChangelog.js

@@ -62,4 +62,6 @@ const Config = require("./config");

.filter(// filter by commit type
commit => !commit.type || !config.changelog.commitTypes || !config.changelog.commitTypes.length
|| config.changelog.commitTypes.includes(commit.type))
commit => (!commit.type && config.changelog.includeInvalidCommits) // undefined commit type
|| !config.changelog.commitTypes || !config.changelog.commitTypes.length // no filter at all
|| (commit.type!==undefined && config.changelog.commitTypes.includes(commit.type)) // commit type in filter list
)
.filter( // filter by commit scope

@@ -66,0 +68,0 @@ commit => !commit.scope || !config.changelog.commitScopes || !config.changelog.commitScopes.length

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

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

@@ -56,2 +59,3 @@ changelogConfig.commitIgnoreRegexPattern = changelogOverride.commitIgnoreRegexPattern || changelogConfig.commitIgnoreRegexPattern;

commitTypes: ['feat', 'fix'],
includeInvalidCommits: true,
commitScopes: null,

@@ -58,0 +62,0 @@ commitIgnoreRegexPattern: null,

@@ -1,8 +0,7 @@

const execa = require('execa');
const execAsync = require('./execAsync');
async function getLastTag(tagGlobPattern, rev = 'HEAD', skipTagOnRev = true) {
const lastTag = await execa('git',
['describe', '--tags', `--match=${tagGlobPattern}`, '--first-parent', '--no-abbrev', rev])
.then(result => result.stdout)
const lastTag = await execAsync(`git describe --tags --match=${tagGlobPattern} --first-parent --no-abbrev ${rev}`, {encoding: 'UTF-8'})
.then(result => result.trim())
.catch(err => {

@@ -28,6 +27,6 @@ // return undefined if no tag was found

const gitLogFormat = ["%h", "%s", "%b"].join(LOG_FIELD_SEPARATOR) + LOG_COMMIT_DELIMITER;
const gitLog = await execa('git', ['log', '--reverse', `--format=${gitLogFormat}`, `${from ? `${from}..` : ''}${to}`])
.then(result => result.stdout + "\n");
return gitLog.split(LOG_COMMIT_DELIMITER + '\n').slice(0, -1)
.map(commit => commit.split(LOG_FIELD_SEPARATOR))
const gitLog = await execAsync(`git log --reverse --format=${gitLogFormat} ${from ? `${from}..` : ''}${to}`, {encoding: 'UTF-8'})
.then(result => result.split(LOG_COMMIT_DELIMITER + '\n').slice(0, -1));
return gitLog.map(commit => commit.split(LOG_FIELD_SEPARATOR))
.map(commit => ({

@@ -49,4 +48,4 @@ hash: commit[0],

const hashArray = await execa('git', ['rev-parse', `${rev1}^{}`, `${rev2}^{}`])
.then(result => result.stdout.split('\n'));
const hashArray = await execAsync(`git rev-parse '${rev1}^{}' '${rev2}^{}'`, {encoding: 'UTF-8'})
.then(result => result.split('\n'));

@@ -59,2 +58,2 @@ return hashArray[0] === hashArray[1];

commitLog: getCommitLog
};
};
const Git = require("./git");
module.exports = function(convention, commitAnchor = 'HEAD') {
let lastTag

@@ -11,3 +11,3 @@ let commitLog

lastTag = await Git.lastTag(convention.releaseTagGlobPattern, commitAnchor)
}
}
return lastTag

@@ -50,3 +50,3 @@ }

};
(await getCommitLog()).forEach(commit => {

@@ -153,2 +153,2 @@ if (commit.breakingChanges && commit.breakingChanges.length) {

this.version = getVersion;
};
};
{
"name": "git-conventional-commits",
"version": "1.1.0",
"version": "1.2.0",
"description": "git conventional commits util",

@@ -15,8 +15,7 @@ "licence": "MIT",

"dependencies": {
"execa": "^5.0.0",
"yargs": "^16.1.1"
"yargs": "^17.3.1"
},
"devDependencies": {
"jest": "^26.1.0",
"tmp-promise": "^3.0.2"
"jest": "^27.5.1",
"tmp-promise": "^3.0.3"
},

@@ -23,0 +22,0 @@ "bin": {

@@ -1,3 +0,4 @@

# Git Conventional Commits
# Git Conventional Commits [![Sparkline](https://stars.medv.io/qoomon/git-conventional-commits.svg)](https://stars.medv.io/qoomon/git-conventional-commits)
[![npm](https://img.shields.io/npm/v/git-conventional-commits)](https://www.npmjs.com/package/git-conventional-commits)

@@ -7,2 +8,5 @@

### Changelog
see [CHANGELOG.md](CHANGELOG.md)
### Install

@@ -51,5 +55,5 @@ `npm install --global git-conventional-commits`

"perf",
"merge",
"?"
"merge"
],
"includeInvalidCommits": true,
"commitScopes": [],

@@ -92,5 +96,4 @@ "commitIgnoreRegexPattern": "^WIP ",

* `merge` commits
* `?` commits with unexpected message format
* if not set or empty commit type filter is disabled
* e.g. `["feat", "fix", "merge" , "?"]`
* e.g. `["feat", "fix", "merge"]`
* `commitScopes` filter commits by scopes

@@ -100,2 +103,4 @@ * a subset of `convention.commitScopes`

* e.g. `["ui"]`
* `includeInvalidCommits` include commits without valid type: default: `true`
* if set to false all commits with undefined `commitTypes` will be removed from changelog
* `commitIgnoreRegexPattern` filter commits by commit subject regex

@@ -102,0 +107,0 @@ * default `^WIP `

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