@modern-js/plugin-changeset 2.22.1-beta.0 → 2.22.1-beta.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.
|
@@ -83,11 +83,15 @@ function getCommitType(message) {
|
|
|
83
83
|
}
|
|
84
84
|
return CommitType.Other;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
const AuthorMap = /* @__PURE__ */ new Map();
|
|
87
|
+
async function getReleaseInfo(commit, commitObj, authToken) {
|
|
87
88
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
88
|
-
const [commitId, message] = commit.split("--");
|
|
89
|
-
const
|
|
90
|
-
|
|
89
|
+
const [commitId, message, email] = commit.split("--");
|
|
90
|
+
const author = AuthorMap.get(email);
|
|
91
|
+
const AuthToken = authToken || process.env.GITHUB_AUTH_TOKEN;
|
|
92
|
+
if (author) {
|
|
93
|
+
commitObj.author = author;
|
|
94
|
+
} else if (AuthToken) {
|
|
91
95
|
try {
|
|
92
96
|
const res = await _axios.default.get(`https://api.github.com/repos/web-infra-dev/modern.js/commits/${commitId}`, {
|
|
93
97
|
method: "GET",
|
|
@@ -96,7 +100,9 @@ async function getReleaseInfo(commit, commitObj) {
|
|
|
96
100
|
Authorization: AuthToken
|
|
97
101
|
}
|
|
98
102
|
});
|
|
99
|
-
|
|
103
|
+
const author2 = res.data.author.login;
|
|
104
|
+
commitObj.author = author2;
|
|
105
|
+
AuthorMap.set(email, author2);
|
|
100
106
|
} catch (e) {
|
|
101
107
|
console.warn(e);
|
|
102
108
|
}
|
|
@@ -42,11 +42,15 @@ export function getCommitType(message) {
|
|
|
42
42
|
}
|
|
43
43
|
return CommitType.Other;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
const AuthorMap = /* @__PURE__ */ new Map();
|
|
46
|
+
export async function getReleaseInfo(commit, commitObj, authToken) {
|
|
46
47
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
47
|
-
const [commitId, message] = commit.split("--");
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const [commitId, message, email] = commit.split("--");
|
|
49
|
+
const author = AuthorMap.get(email);
|
|
50
|
+
const AuthToken = authToken || process.env.GITHUB_AUTH_TOKEN;
|
|
51
|
+
if (author) {
|
|
52
|
+
commitObj.author = author;
|
|
53
|
+
} else if (AuthToken) {
|
|
50
54
|
try {
|
|
51
55
|
const res = await axios.get(`https://api.github.com/repos/web-infra-dev/modern.js/commits/${commitId}`, {
|
|
52
56
|
method: "GET",
|
|
@@ -55,7 +59,9 @@ export async function getReleaseInfo(commit, commitObj) {
|
|
|
55
59
|
Authorization: AuthToken
|
|
56
60
|
}
|
|
57
61
|
});
|
|
58
|
-
|
|
62
|
+
const author2 = res.data.author.login;
|
|
63
|
+
commitObj.author = author2;
|
|
64
|
+
AuthorMap.set(email, author2);
|
|
59
65
|
} catch (e) {
|
|
60
66
|
console.warn(e);
|
|
61
67
|
}
|
|
@@ -24,6 +24,7 @@ export type ReleaseNote = Record<CommitType, Changes>;
|
|
|
24
24
|
interface ReleaseNoteOptions {
|
|
25
25
|
repo?: string;
|
|
26
26
|
custom?: string;
|
|
27
|
+
authToken?: string;
|
|
27
28
|
}
|
|
28
29
|
export type CustomReleaseNoteFunction = {
|
|
29
30
|
getReleaseInfo?: (commit: string, commitObj: Commit) => Commit | Promise<Commit>;
|
|
@@ -46,7 +47,7 @@ export declare const CommitTypeZhTitle: {
|
|
|
46
47
|
other: string;
|
|
47
48
|
};
|
|
48
49
|
export declare function getCommitType(message: string): CommitType;
|
|
49
|
-
export declare function getReleaseInfo(commit: string, commitObj: Commit): Promise<Commit>;
|
|
50
|
+
export declare function getReleaseInfo(commit: string, commitObj: Commit, authToken?: string): Promise<Commit>;
|
|
50
51
|
export declare function getReleaseNoteLine(commit: Commit, customReleaseNoteFunction?: CustomReleaseNoteFunction, lang?: 'en' | 'zh'): string | Promise<string>;
|
|
51
52
|
export declare function genReleaseNote(options: ReleaseNoteOptions): Promise<string>;
|
|
52
53
|
export {};
|