@varlet/release 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +58 -10
- package/dist/index.js +58 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,18 +63,66 @@ function changelog({
|
|
|
63
63
|
file = "CHANGELOG.md",
|
|
64
64
|
preset = "angular",
|
|
65
65
|
writerOpts = {
|
|
66
|
-
transform
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
commit.type =
|
|
75
|
-
} else {
|
|
66
|
+
transform(commit, context) {
|
|
67
|
+
let discard = true;
|
|
68
|
+
const issues = [];
|
|
69
|
+
commit.notes.forEach((note) => {
|
|
70
|
+
note.title = "BREAKING CHANGES";
|
|
71
|
+
discard = false;
|
|
72
|
+
});
|
|
73
|
+
if (commit.type === "feat") {
|
|
74
|
+
commit.type = "Features";
|
|
75
|
+
} else if (commit.type === "fix") {
|
|
76
|
+
commit.type = "Bug Fixes";
|
|
77
|
+
} else if (commit.type === "perf") {
|
|
78
|
+
commit.type = "Performance Improvements";
|
|
79
|
+
} else if (commit.type === "revert" || commit.revert) {
|
|
80
|
+
commit.type = "Reverts";
|
|
81
|
+
} else if (commit.type === "refactor") {
|
|
82
|
+
commit.type = "Code Refactoring";
|
|
83
|
+
} else if (discard) {
|
|
76
84
|
return false;
|
|
85
|
+
} else if (commit.type === "docs") {
|
|
86
|
+
commit.type = "Documentation";
|
|
87
|
+
} else if (commit.type === "style") {
|
|
88
|
+
commit.type = "Styles";
|
|
89
|
+
} else if (commit.type === "test") {
|
|
90
|
+
commit.type = "Tests";
|
|
91
|
+
} else if (commit.type === "build") {
|
|
92
|
+
commit.type = "Build System";
|
|
93
|
+
} else if (commit.type === "ci") {
|
|
94
|
+
commit.type = "Continuous Integration";
|
|
95
|
+
}
|
|
96
|
+
if (commit.scope === "*") {
|
|
97
|
+
commit.scope = "";
|
|
98
|
+
}
|
|
99
|
+
if (typeof commit.hash === "string") {
|
|
100
|
+
commit.shortHash = commit.hash.substring(0, 7);
|
|
77
101
|
}
|
|
102
|
+
if (typeof commit.subject === "string") {
|
|
103
|
+
let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl;
|
|
104
|
+
if (url) {
|
|
105
|
+
url = `${url}/issues/`;
|
|
106
|
+
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
107
|
+
issues.push(issue);
|
|
108
|
+
return `[#${issue}](${url}${issue})`;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (context.host) {
|
|
112
|
+
commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
113
|
+
if (username.includes("/")) {
|
|
114
|
+
return `@${username}`;
|
|
115
|
+
}
|
|
116
|
+
return `[@${username}](${context.host}/${username})`;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
commit.references = commit.references.filter((reference) => {
|
|
121
|
+
if (issues.indexOf(reference.issue) === -1) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
});
|
|
78
126
|
return commit;
|
|
79
127
|
}
|
|
80
128
|
}
|
package/dist/index.js
CHANGED
|
@@ -19,18 +19,66 @@ function changelog({
|
|
|
19
19
|
file = "CHANGELOG.md",
|
|
20
20
|
preset = "angular",
|
|
21
21
|
writerOpts = {
|
|
22
|
-
transform
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
commit.type =
|
|
31
|
-
} else {
|
|
22
|
+
transform(commit, context) {
|
|
23
|
+
let discard = true;
|
|
24
|
+
const issues = [];
|
|
25
|
+
commit.notes.forEach((note) => {
|
|
26
|
+
note.title = "BREAKING CHANGES";
|
|
27
|
+
discard = false;
|
|
28
|
+
});
|
|
29
|
+
if (commit.type === "feat") {
|
|
30
|
+
commit.type = "Features";
|
|
31
|
+
} else if (commit.type === "fix") {
|
|
32
|
+
commit.type = "Bug Fixes";
|
|
33
|
+
} else if (commit.type === "perf") {
|
|
34
|
+
commit.type = "Performance Improvements";
|
|
35
|
+
} else if (commit.type === "revert" || commit.revert) {
|
|
36
|
+
commit.type = "Reverts";
|
|
37
|
+
} else if (commit.type === "refactor") {
|
|
38
|
+
commit.type = "Code Refactoring";
|
|
39
|
+
} else if (discard) {
|
|
32
40
|
return false;
|
|
41
|
+
} else if (commit.type === "docs") {
|
|
42
|
+
commit.type = "Documentation";
|
|
43
|
+
} else if (commit.type === "style") {
|
|
44
|
+
commit.type = "Styles";
|
|
45
|
+
} else if (commit.type === "test") {
|
|
46
|
+
commit.type = "Tests";
|
|
47
|
+
} else if (commit.type === "build") {
|
|
48
|
+
commit.type = "Build System";
|
|
49
|
+
} else if (commit.type === "ci") {
|
|
50
|
+
commit.type = "Continuous Integration";
|
|
51
|
+
}
|
|
52
|
+
if (commit.scope === "*") {
|
|
53
|
+
commit.scope = "";
|
|
54
|
+
}
|
|
55
|
+
if (typeof commit.hash === "string") {
|
|
56
|
+
commit.shortHash = commit.hash.substring(0, 7);
|
|
33
57
|
}
|
|
58
|
+
if (typeof commit.subject === "string") {
|
|
59
|
+
let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl;
|
|
60
|
+
if (url) {
|
|
61
|
+
url = `${url}/issues/`;
|
|
62
|
+
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
63
|
+
issues.push(issue);
|
|
64
|
+
return `[#${issue}](${url}${issue})`;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (context.host) {
|
|
68
|
+
commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
69
|
+
if (username.includes("/")) {
|
|
70
|
+
return `@${username}`;
|
|
71
|
+
}
|
|
72
|
+
return `[@${username}](${context.host}/${username})`;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
commit.references = commit.references.filter((reference) => {
|
|
77
|
+
if (issues.indexOf(reference.issue) === -1) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
34
82
|
return commit;
|
|
35
83
|
}
|
|
36
84
|
}
|