Skip to content

Commit

Permalink
feat: add option that allows to include commit bodies in changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky committed Nov 30, 2023
1 parent 69dda57 commit a869c43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/melos/lib/src/common/changelog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ extension ChangelogStringBufferExtension on StringBuffer {
}

writeln();

if (update.workspace.config.commands.version.includeCommitBody &&
parsedMessage.body != null) {
writeln();
for (final line in parsedMessage.body!.split('\n')) {
write(' ' * 4);
writeln(line);
}
writeln();
}
}
writeln();
}
Expand Down
11 changes: 11 additions & 0 deletions packages/melos/lib/src/workspace_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ class VersionCommandConfigs {
this.includeScopes = true,
this.linkToCommits = false,
this.includeCommitId = false,
this.includeCommitBody = false,
this.updateGitTagRefs = false,
this.releaseUrl = false,
List<AggregateChangelogConfig>? aggregateChangelogs,
Expand Down Expand Up @@ -726,11 +727,18 @@ class VersionCommandConfigs {
)
: VersionLifecycleHooks.empty;

final inlcudeCommitBody = assertKeyIsA<bool?>(
key: 'includeCommitBody',
map: yaml,
path: 'command/version',
);

return VersionCommandConfigs(
branch: branch,
message: message,
includeScopes: includeScopes ?? true,
includeCommitId: includeCommitId ?? false,
includeCommitBody: inlcudeCommitBody ?? false,
linkToCommits: linkToCommits ?? repositoryIsConfigured,
updateGitTagRefs: updateGitTagRefs ?? false,
releaseUrl: releaseUrl ?? false,
Expand All @@ -756,6 +764,9 @@ class VersionCommandConfigs {
/// Whether to add commits ids in the generated CHANGELOG.md.
final bool includeCommitId;

/// Wheter to include commit bodies in the generated CHANGELOG.md.
final bool includeCommitBody;

/// Whether to add links to commits in the generated CHANGELOG.md.
final bool linkToCommits;

Expand Down

0 comments on commit a869c43

Please sign in to comment.