@varlet/release 0.4.0 → 0.4.2
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 +60 -12
- package/dist/index.js +60 -12
- 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
|
}
|
|
@@ -143,7 +191,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
|
|
|
143
191
|
throw new Error("\n" + ret.stderr);
|
|
144
192
|
} else {
|
|
145
193
|
s.success({ text: "Publish all packages successfully" });
|
|
146
|
-
ret.stdout && import_rslog.logger.
|
|
194
|
+
ret.stdout && import_rslog.logger.log(ret.stdout);
|
|
147
195
|
}
|
|
148
196
|
}
|
|
149
197
|
async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
@@ -166,7 +214,7 @@ async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
|
166
214
|
throwOnError: true
|
|
167
215
|
});
|
|
168
216
|
s.success({ text: "Push remote repository successfully" });
|
|
169
|
-
ret.stdout && import_rslog.logger.
|
|
217
|
+
ret.stdout && import_rslog.logger.log(ret.stdout);
|
|
170
218
|
}
|
|
171
219
|
function getPackageJsons() {
|
|
172
220
|
const packageJsons = ["package.json", ...import_glob.glob.sync("packages/*/package.json")];
|
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
|
}
|
|
@@ -99,7 +147,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
|
|
|
99
147
|
throw new Error("\n" + ret.stderr);
|
|
100
148
|
} else {
|
|
101
149
|
s.success({ text: "Publish all packages successfully" });
|
|
102
|
-
ret.stdout && logger.
|
|
150
|
+
ret.stdout && logger.log(ret.stdout);
|
|
103
151
|
}
|
|
104
152
|
}
|
|
105
153
|
async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
@@ -122,7 +170,7 @@ async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
|
122
170
|
throwOnError: true
|
|
123
171
|
});
|
|
124
172
|
s.success({ text: "Push remote repository successfully" });
|
|
125
|
-
ret.stdout && logger.
|
|
173
|
+
ret.stdout && logger.log(ret.stdout);
|
|
126
174
|
}
|
|
127
175
|
function getPackageJsons() {
|
|
128
176
|
const packageJsons = ["package.json", ...glob.sync("packages/*/package.json")];
|