Skip to content

Commit a70e6bb

Browse files
committed
docs: update prepareCommitMsg.ts
1 parent 6294809 commit a70e6bb

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

src/prepareCommitMsg.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ export function _collapse(types: CONVENTIONAL_TYPE[]) {
9999
*
100100
* This finds a common Conventional Commit prefix if one is appropriate and
101101
* returns a message listing all the file names.
102+
*
103+
* @param lines An array of values describing file change from Git output.
104+
* e.g. ["A baz.txt"]
102105
*/
103106
export function _msgNamed(lines: string[]): ConvCommitMsg {
104107
const conventions = lines.map(_prefixFromChange);
@@ -113,7 +116,8 @@ export function _msgNamed(lines: string[]): ConvCommitMsg {
113116
/**
114117
* Generate prefix and count description for multiple file changes.
115118
*
116-
* TODO: Use prefix.
119+
* @param lines An array of values describing file change from Git output.
120+
* e.g. ["A baz.txt"]
117121
*/
118122
export function _msgCount(lines: string[]): ConvCommitMsg {
119123
const prefix = CONVENTIONAL_TYPE.UNKNOWN;
@@ -127,8 +131,8 @@ export function _msgCount(lines: string[]): ConvCommitMsg {
127131
/**
128132
* Generate message from changes to one or more files.
129133
*
130-
* @param lines Lines from the `git diff-index` function, describing changes to
131-
* files.
134+
* @param lines An array of values describing file change from Git output.
135+
* e.g. ["A baz.txt"]
132136
*
133137
* @returns Conventional Commit prefix and a description of changed paths.
134138
*/
@@ -149,6 +153,9 @@ export function _msgFromChanges(lines: string[]) {
149153

150154
/**
151155
* Output a readable conventional commit message.
156+
*
157+
* Use the Conventional Commit type as the prefix if it is known, otherwise
158+
* just use the description.
152159
*/
153160
export function _formatMsg(convCommitMsg: ConvCommitMsg) {
154161
if (convCommitMsg.typePrefix === CONVENTIONAL_TYPE.UNKNOWN) {
@@ -158,7 +165,10 @@ export function _formatMsg(convCommitMsg: ConvCommitMsg) {
158165
}
159166

160167
/**
161-
* Generate a new commit message and format it as a string.
168+
* Generate a new commit message and format it as a string.\
169+
*
170+
* @param lines An array of values describing file change from Git output.
171+
* e.g. ["A baz.txt"]
162172
*/
163173
export function _newMsg(lines: string[]) {
164174
const convCommitMsg = _msgFromChanges(lines);
@@ -167,7 +177,10 @@ export function _newMsg(lines: string[]) {
167177
}
168178

169179
/**
170-
* Join old and automated inferred values as one commit message
180+
* Combine old and generated values as a single commit message.
181+
*
182+
* @param autoMsgPieces Auto-generated new commit message pieces.
183+
* @param oldMsgPieces The original commit message pieces.
171184
*/
172185
export function _joinOldAndNew(
173186
autoMsgPieces: ConvCommitMsg,

0 commit comments

Comments
 (0)