@modern-js/plugin-changeset 1.3.1 → 1.15.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,48 @@
1
1
  # @modern-js/plugin-changeset
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8658a78]
8
+ - Updated dependencies [05d4a4f]
9
+ - Updated dependencies [ad05af9]
10
+ - Updated dependencies [5d53d1c]
11
+ - Updated dependencies [37cd159]
12
+ - @modern-js/utils@1.15.0
13
+ - @modern-js/plugin-i18n@1.15.0
14
+
15
+ ## 1.4.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 3c20a5e: fix: `@modern-js/plugin-changeset` export fields
20
+
21
+ fix: 修复 `@modern-js/plugin-changeset` 导出字段路径
22
+
23
+ - Updated dependencies [79e83ef]
24
+ - Updated dependencies [22f4dca]
25
+ - Updated dependencies [7b9067f]
26
+ - @modern-js/utils@1.9.0
27
+
28
+ ## 1.4.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 33cebd2: chore(plugin-i18n): merge `@modern-js/i18n-cli-language-detector` to `@modern-js/plugin-i18n`
33
+
34
+ chore(plugin-i18n): 合并 `@modern-js/i18n-cli-language-detector` 包到 `@modern-js/plugin-i18n` 包作为子路径
35
+
36
+ ### Patch Changes
37
+
38
+ - 2e8ea92: feat: optimize release note
39
+
40
+ feat: 优化 Release Note 格式
41
+
42
+ - Updated dependencies [33cebd2]
43
+ - @modern-js/plugin-i18n@1.3.0
44
+ - @modern-js/utils@1.7.12
45
+
3
46
  ## 1.3.1
4
47
 
5
48
  ### 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 `[[#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId})] ${summary}${author ? ` -- ${author}` : ''}\n`;
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-cli-language-detector';
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 `[[#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId})] ${summary}${author ? ` -- ${author}` : ''}\n`;
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 _i18nCliLanguageDetector = require("@modern-js/i18n-cli-language-detector");
8
+ var _languageDetector = require("@modern-js/plugin-i18n/language-detector");
9
9
 
10
10
  function getLocaleLanguage() {
11
- const detector = new _i18nCliLanguageDetector.I18CLILanguageDetector();
11
+ const detector = new _languageDetector.I18CLILanguageDetector();
12
12
  return detector.detect();
13
13
  }
package/package.json CHANGED
@@ -11,11 +11,10 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.1",
14
+ "version": "1.15.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
18
- "module": "./dist/js/treeshaking/index.js",
19
18
  "jsnext:modern": "./dist/js/modern/index.js",
20
19
  "exports": {
21
20
  ".": {
@@ -24,7 +23,7 @@
24
23
  "import": "./dist/js/modern/index.js",
25
24
  "require": "./dist/js/node/index.js"
26
25
  },
27
- "default": "./dist/js/treeshaking/index.js"
26
+ "default": "./dist/js/node/index.js"
28
27
  },
29
28
  "./cli": {
30
29
  "jsnext:source": "./src/index.ts",
@@ -36,20 +35,19 @@
36
35
  "@changesets/cli": "^2.23.0",
37
36
  "@changesets/git": "^1.3.2",
38
37
  "@changesets/read": "^0.5.5",
39
- "@modern-js/i18n-cli-language-detector": "^1.2.4",
40
- "@modern-js/plugin-i18n": "^1.2.7",
41
- "@modern-js/utils": "^1.7.9",
38
+ "@modern-js/plugin-i18n": "1.15.0",
39
+ "@modern-js/utils": "1.15.0",
42
40
  "execa": "^5.1.1",
43
41
  "resolve-from": "^5.0.0"
44
42
  },
45
43
  "devDependencies": {
46
- "@modern-js/core": "1.12.2",
47
- "@scripts/build": "0.0.0",
44
+ "@modern-js/core": "1.15.0",
45
+ "@scripts/build": "1.15.0",
48
46
  "@types/jest": "^27",
49
47
  "@types/node": "^14",
50
48
  "typescript": "^4",
51
49
  "jest": "^27",
52
- "@scripts/jest-config": "0.0.0"
50
+ "@scripts/jest-config": "1.15.0"
53
51
  },
54
52
  "sideEffects": false,
55
53
  "publishConfig": {