Sha256: 25b266000a7217818c78017fe745aee1ffbddfe92d59482ee1c5a75ca88ba3e4
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
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, fromLastTag, to, last, edit, gitLogArgs } = settings; let from = settings.from; if (edit) { return getEditCommit(cwd, edit); } if (last) { const gitCommandResult = await execa('git', ['log', '-1', '--pretty=format:%B'], { cwd }); let output = gitCommandResult.stdout; // strip output of extra quotation marks ("") if (output[0] == '"' && output[output.length - 1] == '"') output = output.slice(1, -1); return [output]; } if (!from && fromLastTag) { const { stdout } = await execa('git', [ 'describe', '--abbrev=40', '--always', '--first-parent', '--long', '--tags', ], { cwd }); if (stdout.length === 40) { // Hash only means no last tag. Use that as the from ref which // results in a no-op. from = stdout; } else { // Description will be in the format: <tag>-<count>-g<hash> // Example: v3.2.0-11-g9057371a52adaae5180d93fe4d0bb808d874b9fb // Minus zero based (1), dash (1), "g" prefix (1), hash (40) = -43 const tagSlice = stdout.lastIndexOf('-', stdout.length - 43); from = stdout.slice(0, tagSlice); } } let gitOptions = { from, to }; if (gitLogArgs) { gitOptions = { ...minimist(gitLogArgs.split(' ')), from, to, }; } return getHistoryCommits(gitOptions, { cwd }); } //# sourceMappingURL=read.js.map
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pcp-server-ruby-sdk-0.0.6 | node_modules/@commitlint/read/lib/read.js |
pcp-server-ruby-sdk-0.1.0 | node_modules/@commitlint/read/lib/read.js |