@commitlint/read
Advanced tools
Comparing version 19.0.3 to 19.2.0
@@ -5,2 +5,3 @@ interface GetCommitMessageOptions { | ||
to?: string; | ||
last?: boolean; | ||
edit?: boolean | string; | ||
@@ -7,0 +8,0 @@ gitLogArgs?: string; |
import minimist from 'minimist'; | ||
import { getHistoryCommits } from './get-history-commits.js'; | ||
import { getEditCommit } from './get-edit-commit.js'; | ||
import { execa } from 'execa'; | ||
// Get commit messages | ||
export default async function getCommitMessages(settings) { | ||
const { cwd, from, to, edit, gitLogArgs } = settings; | ||
const { cwd, from, to, last, edit, gitLogArgs } = settings; | ||
if (edit) { | ||
return getEditCommit(cwd, edit); | ||
} | ||
if (last) { | ||
const executeGitCommand = await execa('git', [ | ||
'log', | ||
'-1', | ||
'--pretty=format:"%B"', | ||
]); | ||
return [executeGitCommand.stdout]; | ||
} | ||
let gitOptions = { from, to }; | ||
if (gitLogArgs) { | ||
gitOptions = Object.assign(Object.assign({}, minimist(gitLogArgs.split(' '))), { from, | ||
to }); | ||
gitOptions = { | ||
...minimist(gitLogArgs.split(' ')), | ||
from, | ||
to, | ||
}; | ||
} | ||
@@ -15,0 +27,0 @@ return getHistoryCommits(gitOptions, { cwd }); |
{ | ||
"name": "@commitlint/read", | ||
"type": "module", | ||
"version": "19.0.3", | ||
"version": "19.2.0", | ||
"description": "Read commit messages from a specified range or last edit", | ||
@@ -42,4 +42,3 @@ "main": "lib/read.js", | ||
"@types/git-raw-commits": "^2.0.3", | ||
"@types/minimist": "^1.2.4", | ||
"execa": "^8.0.1" | ||
"@types/minimist": "^1.2.4" | ||
}, | ||
@@ -49,6 +48,7 @@ "dependencies": { | ||
"@commitlint/types": "^19.0.3", | ||
"execa": "^8.0.1", | ||
"git-raw-commits": "^4.0.0", | ||
"minimist": "^1.2.8" | ||
}, | ||
"gitHead": "9b4ac34069e06cd327760ce37adbde8d537d8e3e" | ||
"gitHead": "a64b417b58b3b1e89f07ff529a29a4af223e9369" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11182
4
91
5
+ Addedexeca@^8.0.1
+ Addedcross-spawn@7.0.3(transitive)
+ Addedexeca@8.0.1(transitive)
+ Addedget-stream@8.0.1(transitive)
+ Addedhuman-signals@5.0.0(transitive)
+ Addedis-stream@3.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@4.0.0(transitive)
+ Addednpm-run-path@5.3.0(transitive)
+ Addedonetime@6.0.0(transitive)
+ Addedpath-key@3.1.14.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstrip-final-newline@3.0.0(transitive)
+ Addedwhich@2.0.2(transitive)