This repository was archived by the owner on Dec 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathovh-config.js
64 lines (55 loc) · 2.21 KB
/
ovh-config.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use strict";
module.exports = {
// These are the main types
TYPES: [
{ value: "first", name: "first commit" },
{ value: "feat", name: "A new feature" },
{ value: "fix", name: "A bug fix" },
{ value: "chore", name: "Refactoring, Changing the build process or auxiliary tools and libraries etc" },
{ value: "docs", name: "Documentation" },
{ value: "style", name: "Cosmetics purpose" },
{ value: "test", name: "Adding missing or correcting tests" }
],
// sub types, if you want to be more specific, the type value is replaced by this one
SUB_TYPES: {
chore: [{ value: "merge", name: "A merge chore" }, { value: "refactor", name: "A refactor of code" }, { value: "chore", name: "Other" }]
},
// emojis to add before a type, the type is the key
EMOJIS: {
feat: ":sparkles:",
fix: ":ambulance:",
docs: ":books:",
merge: ":handshake:",
refactor: ":tractor:",
style: ":lipstick:"
},
// should prompt about the scope
useScope: ["feat", "fix", "chore", "docs", "style", "refactor"],
// should prompt about the header
useHeader: ["feat", "chore", "style", "test", "docs", "refactor", "merge"],
// should prompt about the body
useBody: ["feat", "chore", "style", "test"],
// should prompt about the footer which indicates bug fix
useFooter: ["feat", "fix"],
// first line max header lenght
headerLength: 72,
// parser for the commit msg, the only value guarented is type
parseCommitMsg (type, rawScope = "", header = "", body = "", rawFooter = "") {
const scope = rawScope ? `(${rawScope})` : "";
const footer = rawFooter ? `closes : ${rawFooter}` : "";
switch (type) {
case "first":
return ":tada: initial commit";
case "fix":
return `:ambulance: fix${scope}: fix ${rawFooter}`;
case "docs":
case "chore":
case "merge":
case "refactor":
return `${this.EMOJIS[type] || ""} ${type}${scope}: ${header}`;
case "feat":
default:
return `${this.EMOJIS[type] || ""} ${type}${scope}: ${header}\n\n${body}\n\n${footer}`;
}
}
};