forked from conventional-changelog/commitlint
/
parse.ts
46 lines (42 loc) 路 911 Bytes
/
parse.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
export interface Commit {
raw: string;
header: string;
type: string | null;
scope: string | null;
subject: string | null;
body: string | null;
footer: string | null;
mentions: string[];
notes: CommitNote[];
references: CommitReference[];
revert: any;
merge: any;
}
export interface CommitNote {
title: string;
text: string;
}
export interface CommitReference {
raw: string;
prefix: string;
action: string | null;
owner: string | null;
repository: string | null;
issue: string | null;
}
export type Parser = (
message: string,
options: ParserOptions
) => Omit<Commit, 'raw'>;
export interface ParserOptions {
commentChar?: string;
fieldPattern?: RegExp;
headerCorrespondence?: string[];
headerPattern?: RegExp;
issuePrefixes?: string[];
mergeCorrespondence?: string[];
mergePattern?: RegExp;
noteKeywords?: string[];
revertCorrespondence?: string[];
revertPattern?: RegExp;
}