@modern-js/plugin-changeset 2.21.2-alpha.2 → 2.22.1-beta.0
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/CHANGELOG.md +15 -0
- package/dist/cjs/commands/bump.js +3 -1
- package/dist/cjs/commands/change.js +3 -1
- package/dist/cjs/commands/pre.js +3 -1
- package/dist/cjs/commands/release.js +3 -1
- package/dist/cjs/commands/releaseNote.js +47 -14
- package/dist/cjs/commands/status.js +3 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/locale/en.js +3 -1
- package/dist/cjs/locale/index.js +6 -2
- package/dist/cjs/locale/zh.js +3 -1
- package/dist/cjs/utils/changeset.js +6 -2
- package/dist/esm/commands/releaseNote.js +20 -5
- package/dist/types/commands/releaseNote.d.ts +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/plugin-changeset
|
|
2
2
|
|
|
3
|
+
## 2.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7d1b96e: feat(changeset): optimize release note display
|
|
8
|
+
|
|
9
|
+
feat(changeset): 优化生成 Release Note 文案
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [3d48836]
|
|
14
|
+
- Updated dependencies [5050e8e]
|
|
15
|
+
- @modern-js/utils@2.22.0
|
|
16
|
+
- @modern-js/plugin-i18n@2.22.0
|
|
17
|
+
|
|
3
18
|
## 2.21.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "change", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return change;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _utils = require("@modern-js/utils");
|
|
10
12
|
const _utils1 = require("../utils");
|
package/dist/cjs/commands/pre.js
CHANGED
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "release", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return release;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
10
12
|
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
@@ -10,19 +10,38 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
CommitType: ()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
CommitType: function() {
|
|
14
|
+
return CommitType;
|
|
15
|
+
},
|
|
16
|
+
ChangesTitle: function() {
|
|
17
|
+
return ChangesTitle;
|
|
18
|
+
},
|
|
19
|
+
ChangesZhTitle: function() {
|
|
20
|
+
return ChangesZhTitle;
|
|
21
|
+
},
|
|
22
|
+
CommitTypeTitle: function() {
|
|
23
|
+
return CommitTypeTitle;
|
|
24
|
+
},
|
|
25
|
+
CommitTypeZhTitle: function() {
|
|
26
|
+
return CommitTypeZhTitle;
|
|
27
|
+
},
|
|
28
|
+
getCommitType: function() {
|
|
29
|
+
return getCommitType;
|
|
30
|
+
},
|
|
31
|
+
getReleaseInfo: function() {
|
|
32
|
+
return getReleaseInfo;
|
|
33
|
+
},
|
|
34
|
+
getReleaseNoteLine: function() {
|
|
35
|
+
return getReleaseNoteLine;
|
|
36
|
+
},
|
|
37
|
+
genReleaseNote: function() {
|
|
38
|
+
return genReleaseNote;
|
|
39
|
+
}
|
|
22
40
|
});
|
|
23
41
|
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
24
42
|
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
25
43
|
const _resolvefrom = /* @__PURE__ */ _interop_require_default._(require("resolve-from"));
|
|
44
|
+
const _axios = /* @__PURE__ */ _interop_require_default._(require("axios"));
|
|
26
45
|
const _utils = require("@modern-js/utils");
|
|
27
46
|
const _read = /* @__PURE__ */ _interop_require_default._(require("@changesets/read"));
|
|
28
47
|
var CommitType;
|
|
@@ -64,10 +83,24 @@ function getCommitType(message) {
|
|
|
64
83
|
}
|
|
65
84
|
return CommitType.Other;
|
|
66
85
|
}
|
|
67
|
-
function getReleaseInfo(commit, commitObj) {
|
|
86
|
+
async function getReleaseInfo(commit, commitObj) {
|
|
68
87
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
69
|
-
const [, message
|
|
70
|
-
|
|
88
|
+
const [commitId, message] = commit.split("--");
|
|
89
|
+
const AuthToken = process.env.GITHUB_AUTH_TOKEN;
|
|
90
|
+
if (AuthToken) {
|
|
91
|
+
try {
|
|
92
|
+
const res = await _axios.default.get(`https://api.github.com/repos/web-infra-dev/modern.js/commits/${commitId}`, {
|
|
93
|
+
method: "GET",
|
|
94
|
+
headers: {
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
Authorization: AuthToken
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
commitObj.author = res.data.author.login;
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.warn(e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
71
104
|
if ((message || commitObj.summary).match(commitRegex)) {
|
|
72
105
|
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
73
106
|
commitObj.pullRequestId = pullRequestId;
|
|
@@ -140,7 +173,7 @@ async function genReleaseNote(options) {
|
|
|
140
173
|
for (const changeset of changesets) {
|
|
141
174
|
const { stdout } = await (0, _utils.execa)("git", [
|
|
142
175
|
"log",
|
|
143
|
-
"--pretty=format:%h--%s--%
|
|
176
|
+
"--pretty=format:%h--%s--%ae",
|
|
144
177
|
`.changeset/${changeset.id}.md`
|
|
145
178
|
]);
|
|
146
179
|
const [id, message] = stdout.split("--");
|
|
@@ -156,7 +189,7 @@ async function genReleaseNote(options) {
|
|
|
156
189
|
if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
|
|
157
190
|
commitObj = await customReleaseNoteFunction.getReleaseInfo(stdout, commitObj);
|
|
158
191
|
} else {
|
|
159
|
-
commitObj = getReleaseInfo(stdout, commitObj);
|
|
192
|
+
commitObj = await getReleaseInfo(stdout, commitObj);
|
|
160
193
|
}
|
|
161
194
|
releaseNote[commitObj.type].en.push(commitObj);
|
|
162
195
|
if (commitObj.summary_zh) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
10
12
|
const _languagedetector = require("@modern-js/plugin-i18n/language-detector");
|
package/dist/cjs/locale/en.js
CHANGED
package/dist/cjs/locale/index.js
CHANGED
|
@@ -10,8 +10,12 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
i18n: ()
|
|
14
|
-
|
|
13
|
+
i18n: function() {
|
|
14
|
+
return i18n;
|
|
15
|
+
},
|
|
16
|
+
localeKeys: function() {
|
|
17
|
+
return localeKeys;
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
20
|
const _plugini18n = require("@modern-js/plugin-i18n");
|
|
17
21
|
const _zh = require("./zh");
|
package/dist/cjs/locale/zh.js
CHANGED
|
@@ -10,8 +10,12 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
CHANGESET_PATH: ()
|
|
14
|
-
|
|
13
|
+
CHANGESET_PATH: function() {
|
|
14
|
+
return CHANGESET_PATH;
|
|
15
|
+
},
|
|
16
|
+
execaWithStreamLog: function() {
|
|
17
|
+
return execaWithStreamLog;
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
20
|
const _utils = require("@modern-js/utils");
|
|
17
21
|
const CHANGESET_PATH = require.resolve("@changesets/cli");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import resolveFrom from "resolve-from";
|
|
3
|
+
import axios from "axios";
|
|
3
4
|
import { fs, execa } from "@modern-js/utils";
|
|
4
5
|
import readChangesets from "@changesets/read";
|
|
5
6
|
export var CommitType;
|
|
@@ -41,10 +42,24 @@ export function getCommitType(message) {
|
|
|
41
42
|
}
|
|
42
43
|
return CommitType.Other;
|
|
43
44
|
}
|
|
44
|
-
export function getReleaseInfo(commit, commitObj) {
|
|
45
|
+
export async function getReleaseInfo(commit, commitObj) {
|
|
45
46
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
46
|
-
const [, message
|
|
47
|
-
|
|
47
|
+
const [commitId, message] = commit.split("--");
|
|
48
|
+
const AuthToken = process.env.GITHUB_AUTH_TOKEN;
|
|
49
|
+
if (AuthToken) {
|
|
50
|
+
try {
|
|
51
|
+
const res = await axios.get(`https://api.github.com/repos/web-infra-dev/modern.js/commits/${commitId}`, {
|
|
52
|
+
method: "GET",
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
Authorization: AuthToken
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
commitObj.author = res.data.author.login;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.warn(e);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
48
63
|
if ((message || commitObj.summary).match(commitRegex)) {
|
|
49
64
|
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
50
65
|
commitObj.pullRequestId = pullRequestId;
|
|
@@ -117,7 +132,7 @@ export async function genReleaseNote(options) {
|
|
|
117
132
|
for (const changeset of changesets) {
|
|
118
133
|
const { stdout } = await execa("git", [
|
|
119
134
|
"log",
|
|
120
|
-
"--pretty=format:%h--%s--%
|
|
135
|
+
"--pretty=format:%h--%s--%ae",
|
|
121
136
|
`.changeset/${changeset.id}.md`
|
|
122
137
|
]);
|
|
123
138
|
const [id, message] = stdout.split("--");
|
|
@@ -133,7 +148,7 @@ export async function genReleaseNote(options) {
|
|
|
133
148
|
if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
|
|
134
149
|
commitObj = await customReleaseNoteFunction.getReleaseInfo(stdout, commitObj);
|
|
135
150
|
} else {
|
|
136
|
-
commitObj = getReleaseInfo(stdout, commitObj);
|
|
151
|
+
commitObj = await getReleaseInfo(stdout, commitObj);
|
|
137
152
|
}
|
|
138
153
|
releaseNote[commitObj.type].en.push(commitObj);
|
|
139
154
|
if (commitObj.summary_zh) {
|
|
@@ -46,7 +46,7 @@ export declare const CommitTypeZhTitle: {
|
|
|
46
46
|
other: string;
|
|
47
47
|
};
|
|
48
48
|
export declare function getCommitType(message: string): CommitType;
|
|
49
|
-
export declare function getReleaseInfo(commit: string, commitObj: Commit): Commit
|
|
49
|
+
export declare function getReleaseInfo(commit: string, commitObj: Commit): Promise<Commit>;
|
|
50
50
|
export declare function getReleaseNoteLine(commit: Commit, customReleaseNoteFunction?: CustomReleaseNoteFunction, lang?: 'en' | 'zh'): string | Promise<string>;
|
|
51
51
|
export declare function genReleaseNote(options: ReleaseNoteOptions): Promise<string>;
|
|
52
52
|
export {};
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.22.1-beta.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -49,19 +49,20 @@
|
|
|
49
49
|
"@changesets/cli": "^2.26.0",
|
|
50
50
|
"@changesets/git": "^1.3.2",
|
|
51
51
|
"@changesets/read": "^0.5.5",
|
|
52
|
-
"@modern-js/plugin-i18n": "2.
|
|
53
|
-
"@modern-js/utils": "2.
|
|
52
|
+
"@modern-js/plugin-i18n": "2.22.0",
|
|
53
|
+
"@modern-js/utils": "2.22.0",
|
|
54
54
|
"resolve-from": "^5.0.0",
|
|
55
|
+
"axios": "^1.2.1",
|
|
55
56
|
"@swc/helpers": "0.5.1"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@modern-js/core": "2.
|
|
59
|
-
"@scripts/build": "2.
|
|
59
|
+
"@modern-js/core": "2.22.0",
|
|
60
|
+
"@scripts/build": "2.22.0",
|
|
60
61
|
"@types/jest": "^29",
|
|
61
62
|
"@types/node": "^14",
|
|
62
63
|
"typescript": "^5",
|
|
63
64
|
"jest": "^29",
|
|
64
|
-
"@scripts/jest-config": "2.
|
|
65
|
+
"@scripts/jest-config": "2.22.0"
|
|
65
66
|
},
|
|
66
67
|
"sideEffects": false,
|
|
67
68
|
"publishConfig": {
|