Skip to content

Commit c4b46f1

Browse files
committed
feat(conventional-commits): add total scope count to output
1 parent 9de72e9 commit c4b46f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/handlers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,15 @@ export function handleGetConventionalCommits(args: any) {
445445
return releaseDate >= sinceDate && releaseDate <= untilDate;
446446
});
447447

448+
const sortedScopes = Object.entries(scopes).sort(([,a], [,b]) => b - a);
449+
448450
return {
449451
totalCommits: lines.length,
450452
conventionalCommits: conventional,
451453
conventionalPercentage: `${((conventional / lines.length) * 100).toFixed(1)}%`,
452454
commitTypes: Object.entries(types).sort(([,a], [,b]) => b - a).map(([type, count]) => ({ type, count })),
453-
topScopes: Object.entries(scopes).sort(([,a], [,b]) => b - a).slice(0, 10).map(([scope, count]) => ({ scope, count })),
455+
topScopes: sortedScopes.slice(0, 10).map(([scope, count]) => ({ scope, count })),
456+
totalScopeCount: sortedScopes.length,
454457
breakingChanges: breaking,
455458
recentReleases: releases,
456459
totalReleasesCount: releases.length,

0 commit comments

Comments
 (0)