@modern-js/plugin-changeset 1.3.1 → 1.4.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
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @modern-js/plugin-changeset
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 33cebd2: chore(plugin-i18n): merge `@modern-js/i18n-cli-language-detector` to `@modern-js/plugin-i18n`
|
|
8
|
+
|
|
9
|
+
chore(plugin-i18n): 合并 `@modern-js/i18n-cli-language-detector` 包到 `@modern-js/plugin-i18n` 包作为子路径
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2e8ea92: feat: optimize release note
|
|
14
|
+
|
|
15
|
+
feat: 优化 Release Note 格式
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [33cebd2]
|
|
18
|
+
- @modern-js/plugin-i18n@1.3.0
|
|
19
|
+
- @modern-js/utils@1.7.12
|
|
20
|
+
|
|
3
21
|
## 1.3.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -15,6 +15,24 @@ export function getReleaseInfo(commit, commitObj) {
|
|
|
15
15
|
|
|
16
16
|
return commitObj;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
function formatSummary(summary, pullRequestId) {
|
|
20
|
+
const [firstLine, ...futureLines] = summary.split('\n').map(l => l.trimRight());
|
|
21
|
+
let returnVal = firstLine;
|
|
22
|
+
|
|
23
|
+
if (futureLines.length > 0) {
|
|
24
|
+
if (pullRequestId) {
|
|
25
|
+
returnVal = `\n\n ${returnVal}`;
|
|
26
|
+
} else {
|
|
27
|
+
returnVal = `\n ${returnVal}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
returnVal += `\n\n ${futureLines.filter(l => Boolean(l)).map(l => l).join('\n\n')}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return returnVal;
|
|
34
|
+
}
|
|
35
|
+
|
|
18
36
|
export function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
19
37
|
if (customReleaseNoteFunction !== null && customReleaseNoteFunction !== void 0 && customReleaseNoteFunction.getReleaseNoteLine) {
|
|
20
38
|
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
@@ -23,17 +41,18 @@ export function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
|
23
41
|
const {
|
|
24
42
|
repository,
|
|
25
43
|
pullRequestId,
|
|
26
|
-
summary
|
|
27
|
-
author
|
|
44
|
+
summary
|
|
28
45
|
} = commit;
|
|
29
46
|
|
|
30
47
|
if (pullRequestId && repository) {
|
|
31
|
-
return
|
|
32
|
-
} else if (pullRequestId) {
|
|
33
|
-
return `[#${pullRequestId}] ${summary}${author ? ` -- ${author}` : ''}\n`;
|
|
34
|
-
} else {
|
|
35
|
-
return `${summary}${author ? ` -- ${author}` : ''}\n`;
|
|
48
|
+
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(summary, pullRequestId)}\n`;
|
|
36
49
|
}
|
|
50
|
+
|
|
51
|
+
if (pullRequestId) {
|
|
52
|
+
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}\n`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return `${formatSummary(summary, pullRequestId)}\n`;
|
|
37
56
|
}
|
|
38
57
|
export async function genReleaseNote(options) {
|
|
39
58
|
const cwd = process.cwd();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I18CLILanguageDetector } from '@modern-js/i18n
|
|
1
|
+
import { I18CLILanguageDetector } from '@modern-js/plugin-i18n/language-detector';
|
|
2
2
|
export function getLocaleLanguage() {
|
|
3
3
|
const detector = new I18CLILanguageDetector();
|
|
4
4
|
return detector.detect();
|
|
@@ -31,6 +31,23 @@ function getReleaseInfo(commit, commitObj) {
|
|
|
31
31
|
return commitObj;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function formatSummary(summary, pullRequestId) {
|
|
35
|
+
const [firstLine, ...futureLines] = summary.split('\n').map(l => l.trimRight());
|
|
36
|
+
let returnVal = firstLine;
|
|
37
|
+
|
|
38
|
+
if (futureLines.length > 0) {
|
|
39
|
+
if (pullRequestId) {
|
|
40
|
+
returnVal = `\n\n ${returnVal}`;
|
|
41
|
+
} else {
|
|
42
|
+
returnVal = `\n ${returnVal}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
returnVal += `\n\n ${futureLines.filter(l => Boolean(l)).map(l => l).join('\n\n')}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return returnVal;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
35
52
|
if (customReleaseNoteFunction !== null && customReleaseNoteFunction !== void 0 && customReleaseNoteFunction.getReleaseNoteLine) {
|
|
36
53
|
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
@@ -39,17 +56,18 @@ function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
|
39
56
|
const {
|
|
40
57
|
repository,
|
|
41
58
|
pullRequestId,
|
|
42
|
-
summary
|
|
43
|
-
author
|
|
59
|
+
summary
|
|
44
60
|
} = commit;
|
|
45
61
|
|
|
46
62
|
if (pullRequestId && repository) {
|
|
47
|
-
return
|
|
48
|
-
} else if (pullRequestId) {
|
|
49
|
-
return `[#${pullRequestId}] ${summary}${author ? ` -- ${author}` : ''}\n`;
|
|
50
|
-
} else {
|
|
51
|
-
return `${summary}${author ? ` -- ${author}` : ''}\n`;
|
|
63
|
+
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(summary, pullRequestId)}\n`;
|
|
52
64
|
}
|
|
65
|
+
|
|
66
|
+
if (pullRequestId) {
|
|
67
|
+
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}\n`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return `${formatSummary(summary, pullRequestId)}\n`;
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
async function genReleaseNote(options) {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getLocaleLanguage = getLocaleLanguage;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _languageDetector = require("@modern-js/plugin-i18n/language-detector");
|
|
9
9
|
|
|
10
10
|
function getLocaleLanguage() {
|
|
11
|
-
const detector = new
|
|
11
|
+
const detector = new _languageDetector.I18CLILanguageDetector();
|
|
12
12
|
return detector.detect();
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.4.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
"@changesets/cli": "^2.23.0",
|
|
37
37
|
"@changesets/git": "^1.3.2",
|
|
38
38
|
"@changesets/read": "^0.5.5",
|
|
39
|
-
"@modern-js/i18n
|
|
40
|
-
"@modern-js/
|
|
41
|
-
"@modern-js/utils": "^1.7.9",
|
|
39
|
+
"@modern-js/plugin-i18n": "^1.3.0",
|
|
40
|
+
"@modern-js/utils": "^1.7.12",
|
|
42
41
|
"execa": "^5.1.1",
|
|
43
42
|
"resolve-from": "^5.0.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@modern-js/core": "1.
|
|
45
|
+
"@modern-js/core": "1.13.0",
|
|
47
46
|
"@scripts/build": "0.0.0",
|
|
48
47
|
"@types/jest": "^27",
|
|
49
48
|
"@types/node": "^14",
|