gitgraph.js
gitgraph.js copied to clipboard
Introduce explicit "message" concept in commit options
As mentioned in #301, a more intuitive usage of the .commit() options API would be to have a message attribute instead of subject and body.
https://github.com/nicoespeon/gitgraph.js/blob/4f85de4702881326520a1efcd11a221835eb9031/packages/gitgraph-core/src/user-api/gitgraph-user-api.ts#L20-L23
Proposed changes:
interface GitgraphCommitOptions<TNode> extends CommitRenderOptions<TNode> {
author?: string;
+ message?: string | CommitMessage;
- subject?: string;
- body?: string;
hash?: string;
style?: TemplateOptions["commit"];
dotText?: string;
tag?: string;
onClick?: (commit: Commit<TNode>) => void;
onMessageClick?: (commit: Commit<TNode>) => void;
onMouseOver?: (commit: Commit<TNode>) => void;
onMouseOut?: (commit: Commit<TNode>) => void;
}
With the following interface:
interface CommitMessage {
subject?: string;
body?: string;
}
If message is a string, it'd be an alias for message.subject.
☝️ That would be a breaking change of the API, obviously.