gitgraph.js icon indicating copy to clipboard operation
gitgraph.js copied to clipboard

Introduce explicit "message" concept in commit options

Open nicoespeon opened this issue 6 years ago • 1 comments

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.

nicoespeon avatar Jun 20 '19 09:06 nicoespeon

☝️ That would be a breaking change of the API, obviously.

nicoespeon avatar Jun 20 '19 10:06 nicoespeon