@modern-js/plugin-changeset 2.21.2-alpha.1 → 2.22.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/commands/bump.js +3 -1
  3. package/dist/cjs/commands/change.js +3 -1
  4. package/dist/cjs/commands/pre.js +3 -1
  5. package/dist/cjs/commands/release.js +3 -1
  6. package/dist/cjs/commands/releaseNote.js +31 -13
  7. package/dist/cjs/commands/status.js +3 -1
  8. package/dist/cjs/index.js +3 -1
  9. package/dist/cjs/locale/en.js +3 -1
  10. package/dist/cjs/locale/index.js +6 -2
  11. package/dist/cjs/locale/zh.js +3 -1
  12. package/dist/cjs/utils/changeset.js +6 -2
  13. package/dist/esm/commands/releaseNote.js +4 -4
  14. package/dist/types/commands/releaseNote.d.ts +1 -1
  15. package/package.json +7 -7
  16. package/dist/js/modern/commands/bump.js +0 -66
  17. package/dist/js/modern/commands/change.js +0 -57
  18. package/dist/js/modern/commands/index.js +0 -6
  19. package/dist/js/modern/commands/pre.js +0 -33
  20. package/dist/js/modern/commands/release-note.js +0 -162
  21. package/dist/js/modern/commands/release.js +0 -76
  22. package/dist/js/modern/commands/status.js +0 -42
  23. package/dist/js/modern/index.js +0 -53
  24. package/dist/js/modern/locale/en.js +0 -41
  25. package/dist/js/modern/locale/index.js +0 -9
  26. package/dist/js/modern/locale/zh.js +0 -41
  27. package/dist/js/modern/utils/changeset.js +0 -14
  28. package/dist/js/modern/utils/index.js +0 -2
  29. package/dist/js/modern/utils/language.js +0 -8
  30. package/dist/js/node/commands/bump.js +0 -89
  31. package/dist/js/node/commands/change.js +0 -75
  32. package/dist/js/node/commands/index.js +0 -22
  33. package/dist/js/node/commands/pre.js +0 -56
  34. package/dist/js/node/commands/release-note.js +0 -193
  35. package/dist/js/node/commands/release.js +0 -100
  36. package/dist/js/node/commands/status.js +0 -65
  37. package/dist/js/node/index.js +0 -75
  38. package/dist/js/node/locale/en.js +0 -64
  39. package/dist/js/node/locale/index.js +0 -33
  40. package/dist/js/node/locale/zh.js +0 -64
  41. package/dist/js/node/utils/changeset.js +0 -44
  42. package/dist/js/node/utils/index.js +0 -18
  43. package/dist/js/node/utils/language.js +0 -31
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, "bump", {
6
6
  enumerable: true,
7
- get: () => bump
7
+ get: function() {
8
+ return bump;
9
+ }
8
10
  });
9
11
  const _utils = require("../utils");
10
12
  async function bump(options) {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "change", {
6
6
  enumerable: true,
7
- get: () => change
7
+ get: function() {
8
+ return change;
9
+ }
8
10
  });
9
11
  const _utils = require("@modern-js/utils");
10
12
  const _utils1 = require("../utils");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "pre", {
6
6
  enumerable: true,
7
- get: () => pre
7
+ get: function() {
8
+ return pre;
9
+ }
8
10
  });
9
11
  const _utils = require("../utils");
10
12
  async function pre(type, tag = "next") {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "release", {
6
6
  enumerable: true,
7
- get: () => release
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,15 +10,33 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- CommitType: () => CommitType,
14
- ChangesTitle: () => ChangesTitle,
15
- ChangesZhTitle: () => ChangesZhTitle,
16
- CommitTypeTitle: () => CommitTypeTitle,
17
- CommitTypeZhTitle: () => CommitTypeZhTitle,
18
- getCommitType: () => getCommitType,
19
- getReleaseInfo: () => getReleaseInfo,
20
- getReleaseNoteLine: () => getReleaseNoteLine,
21
- genReleaseNote: () => genReleaseNote
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"));
@@ -77,15 +95,15 @@ function getReleaseInfo(commit, commitObj) {
77
95
  }
78
96
  function getReleaseNoteLine(commit, customReleaseNoteFunction, lang = "en") {
79
97
  if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
80
- return customReleaseNoteFunction.getReleaseNoteLine(commit);
98
+ return customReleaseNoteFunction.getReleaseNoteLine(commit, lang);
81
99
  }
82
100
  const { repository, pullRequestId, summary, summary_zh, author } = commit;
83
- const pullRequest = pullRequestId ? `https://github.com/${repository}/pull/${pullRequestId}` : "";
101
+ const pullRequest = pullRequestId && repository ? `https://github.com/${repository}/pull/${pullRequestId}` : "";
84
102
  if (lang === "en") {
85
- return `- ${summary} by @${author}${pullRequest ? ` in ${pullRequest}` : ""}
103
+ return `- ${summary}${author ? ` by @${author}` : ""}${pullRequest ? ` in ${pullRequest}` : ""}
86
104
  `;
87
105
  }
88
- return `- ${summary_zh} 由 @${author} 实现${pullRequest ? `, 详情可查看 ${pullRequest}` : ""}
106
+ return `- ${summary_zh}${author ? ` 由 @${author} 实现` : ""}${pullRequest ? `, 详情可查看 ${pullRequest}` : ""}
89
107
  `;
90
108
  }
91
109
  async function genReleaseNote(options) {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "status", {
6
6
  enumerable: true,
7
- get: () => status
7
+ get: function() {
8
+ return status;
9
+ }
8
10
  });
9
11
  const _utils = require("../utils");
10
12
  async function status(options) {
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: () => _default
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");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "EN_LOCALE", {
6
6
  enumerable: true,
7
- get: () => EN_LOCALE
7
+ get: function() {
8
+ return EN_LOCALE;
9
+ }
8
10
  });
9
11
  const EN_LOCALE = {
10
12
  command: {
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- i18n: () => i18n,
14
- localeKeys: () => localeKeys
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");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "ZH_LOCALE", {
6
6
  enumerable: true,
7
- get: () => ZH_LOCALE
7
+ get: function() {
8
+ return ZH_LOCALE;
9
+ }
8
10
  });
9
11
  const ZH_LOCALE = {
10
12
  command: {
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- CHANGESET_PATH: () => CHANGESET_PATH,
14
- execaWithStreamLog: () => execaWithStreamLog
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");
@@ -54,15 +54,15 @@ export function getReleaseInfo(commit, commitObj) {
54
54
  }
55
55
  export function getReleaseNoteLine(commit, customReleaseNoteFunction, lang = "en") {
56
56
  if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
57
- return customReleaseNoteFunction.getReleaseNoteLine(commit);
57
+ return customReleaseNoteFunction.getReleaseNoteLine(commit, lang);
58
58
  }
59
59
  const { repository, pullRequestId, summary, summary_zh, author } = commit;
60
- const pullRequest = pullRequestId ? `https://github.com/${repository}/pull/${pullRequestId}` : "";
60
+ const pullRequest = pullRequestId && repository ? `https://github.com/${repository}/pull/${pullRequestId}` : "";
61
61
  if (lang === "en") {
62
- return `- ${summary} by @${author}${pullRequest ? ` in ${pullRequest}` : ""}
62
+ return `- ${summary}${author ? ` by @${author}` : ""}${pullRequest ? ` in ${pullRequest}` : ""}
63
63
  `;
64
64
  }
65
- return `- ${summary_zh} 由 @${author} 实现${pullRequest ? `, 详情可查看 ${pullRequest}` : ""}
65
+ return `- ${summary_zh}${author ? ` 由 @${author} 实现` : ""}${pullRequest ? `, 详情可查看 ${pullRequest}` : ""}
66
66
  `;
67
67
  }
68
68
  export async function genReleaseNote(options) {
@@ -27,7 +27,7 @@ interface ReleaseNoteOptions {
27
27
  }
28
28
  export type CustomReleaseNoteFunction = {
29
29
  getReleaseInfo?: (commit: string, commitObj: Commit) => Commit | Promise<Commit>;
30
- getReleaseNoteLine?: (commit: Commit) => string | Promise<string>;
30
+ getReleaseNoteLine?: (commit: Commit, lang?: 'en' | 'zh') => string | Promise<string>;
31
31
  } | undefined;
32
32
  export declare const ChangesTitle = "What's Changed";
33
33
  export declare const ChangesZhTitle = "\u66F4\u65B0\u5185\u5BB9";
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.21.2-alpha.1",
18
+ "version": "2.22.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,19 @@
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.21.1",
53
- "@modern-js/utils": "2.21.1",
54
52
  "resolve-from": "^5.0.0",
55
- "@swc/helpers": "0.5.1"
53
+ "@swc/helpers": "0.5.1",
54
+ "@modern-js/plugin-i18n": "2.22.0",
55
+ "@modern-js/utils": "2.22.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@modern-js/core": "2.21.1",
59
- "@scripts/build": "2.21.1",
60
58
  "@types/jest": "^29",
61
59
  "@types/node": "^14",
62
60
  "typescript": "^5",
63
61
  "jest": "^29",
64
- "@scripts/jest-config": "2.21.1"
62
+ "@modern-js/core": "2.22.0",
63
+ "@scripts/jest-config": "2.22.0",
64
+ "@scripts/build": "2.22.0"
65
65
  },
66
66
  "sideEffects": false,
67
67
  "publishConfig": {
@@ -1,66 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
22
- function bump(options) {
23
- return __async(this, null, function* () {
24
- const { snapshot, canary, preid, ignore } = options;
25
- const params = [CHANGESET_PATH, "version"];
26
- if (snapshot) {
27
- params.push("--snapshot");
28
- if (typeof snapshot === "string") {
29
- params.push(snapshot);
30
- }
31
- }
32
- if (ignore) {
33
- ignore.forEach((pkg) => {
34
- params.push("--ignore");
35
- params.push(pkg);
36
- });
37
- }
38
- if (canary) {
39
- yield execaWithStreamLog(process.execPath, [
40
- CHANGESET_PATH,
41
- "pre",
42
- "enter",
43
- preid || "next"
44
- ]);
45
- try {
46
- yield execaWithStreamLog(process.execPath, params);
47
- yield execaWithStreamLog(process.execPath, [
48
- CHANGESET_PATH,
49
- "pre",
50
- "exit"
51
- ]);
52
- } catch (e) {
53
- yield execaWithStreamLog(process.execPath, [
54
- CHANGESET_PATH,
55
- "pre",
56
- "exit"
57
- ]);
58
- }
59
- } else {
60
- yield execaWithStreamLog(process.execPath, params);
61
- }
62
- });
63
- }
64
- export {
65
- bump
66
- };
@@ -1,57 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import {
22
- isMonorepo,
23
- getMonorepoPackages,
24
- getPackageManager,
25
- logger
26
- } from "@modern-js/utils";
27
- import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
28
- import { i18n, localeKeys } from "../locale";
29
- function change(options) {
30
- return __async(this, null, function* () {
31
- const appDir = process.cwd();
32
- if (isMonorepo(appDir)) {
33
- const packages = getMonorepoPackages(appDir);
34
- if (packages.length === 0) {
35
- const packageManager = yield getPackageManager(appDir);
36
- logger.warn(
37
- i18n.t(localeKeys.command.change.no_packages, {
38
- packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
39
- })
40
- );
41
- return;
42
- }
43
- }
44
- const { empty, open } = options;
45
- const params = [CHANGESET_PATH, "add"];
46
- if (empty) {
47
- params.push("--empty");
48
- }
49
- if (open) {
50
- params.push("--open");
51
- }
52
- yield execaWithStreamLog(process.execPath, params);
53
- });
54
- }
55
- export {
56
- change
57
- };
@@ -1,6 +0,0 @@
1
- export * from "./change";
2
- export * from "./bump";
3
- export * from "./pre";
4
- export * from "./release";
5
- export * from "./status";
6
- export * from "./release-note";
@@ -1,33 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
22
- function pre(type, tag = "next") {
23
- return __async(this, null, function* () {
24
- const params = [CHANGESET_PATH, "pre", type];
25
- if (type === "enter") {
26
- params.push(tag);
27
- }
28
- yield execaWithStreamLog(process.execPath, params);
29
- });
30
- }
31
- export {
32
- pre
33
- };
@@ -1,162 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import path from "path";
22
- import resolveFrom from "resolve-from";
23
- import { fs, execa } from "@modern-js/utils";
24
- import readChangesets from "@changesets/read";
25
- function getReleaseInfo(commit, commitObj) {
26
- const commitRegex = /(.*)\(#(\d*)\)/;
27
- const [, message, author] = commit.split("--");
28
- commitObj.author = author;
29
- if ((message || commitObj.summary).match(commitRegex)) {
30
- const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
31
- commitObj.pullRequestId = pullRequestId;
32
- commitObj.message = messageShort.trim();
33
- }
34
- return commitObj;
35
- }
36
- function formatSummary(summary, pullRequestId) {
37
- const [firstLine, ...futureLines] = summary.split("\n").map((l) => l.trimRight());
38
- let returnVal = firstLine;
39
- if (futureLines.length > 0) {
40
- if (pullRequestId) {
41
- returnVal = `
42
-
43
- ${returnVal}`;
44
- } else {
45
- returnVal = `
46
- ${returnVal}`;
47
- }
48
- returnVal += `
49
-
50
- ${futureLines.filter((l) => Boolean(l)).map((l) => l).join("\n\n")}`;
51
- }
52
- return returnVal;
53
- }
54
- function getReleaseNoteLine(commit, customReleaseNoteFunction) {
55
- if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
56
- return customReleaseNoteFunction.getReleaseNoteLine(commit);
57
- }
58
- const { repository, pullRequestId, summary } = commit;
59
- if (pullRequestId && repository) {
60
- return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(
61
- summary,
62
- pullRequestId
63
- )}
64
- `;
65
- }
66
- if (pullRequestId) {
67
- return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}
68
- `;
69
- }
70
- return `${formatSummary(summary, pullRequestId)}
71
- `;
72
- }
73
- function genReleaseNote(options) {
74
- return __async(this, null, function* () {
75
- const cwd = process.cwd();
76
- const { repo, custom } = options;
77
- let repository = repo;
78
- let customReleaseNoteFunction;
79
- if (!repo) {
80
- const pkg = yield fs.readJSON(path.join(cwd, "package.json"));
81
- ({ repository } = pkg);
82
- }
83
- if (custom) {
84
- let possibleReleaseNoteFunc;
85
- const releasenotePath = resolveFrom(cwd, custom);
86
- possibleReleaseNoteFunc = require(releasenotePath);
87
- if (possibleReleaseNoteFunc.default) {
88
- possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
89
- }
90
- if (typeof possibleReleaseNoteFunc.getReleaseInfo === "function" && typeof possibleReleaseNoteFunc.getReleaseNoteLine === "function") {
91
- customReleaseNoteFunction = possibleReleaseNoteFunc;
92
- } else {
93
- throw new Error("Could not resolve relesae note generation functions");
94
- }
95
- }
96
- const changesets = yield readChangesets(cwd);
97
- if (changesets.length === 0) {
98
- console.warn("No unreleased changesets found.");
99
- process.exit(1);
100
- }
101
- const features = [];
102
- const bugFix = [];
103
- for (const changeset of changesets) {
104
- const { stdout } = yield execa("git", [
105
- "log",
106
- "--pretty=format:%h--%s--%an",
107
- `.changeset/${changeset.id}.md`
108
- ]);
109
- const [id, message] = stdout.split("--");
110
- let commitObj = {
111
- id,
112
- type: (message || changeset.summary).startsWith("fix") ? "fix" : "feature",
113
- repository,
114
- message: (message || changeset.summary).trim(),
115
- summary: changeset.summary
116
- };
117
- if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
118
- commitObj = yield customReleaseNoteFunction.getReleaseInfo(
119
- stdout,
120
- commitObj
121
- );
122
- } else {
123
- commitObj = getReleaseInfo(stdout, commitObj);
124
- }
125
- if (commitObj.type === "fix") {
126
- bugFix.push(commitObj);
127
- } else {
128
- features.push(commitObj);
129
- }
130
- }
131
- if (!features.length && !bugFix.length) {
132
- console.warn(
133
- "no release note found, you can run `pnpm run add` to add changeset"
134
- );
135
- }
136
- if (features.length) {
137
- console.info("## Features:\n");
138
- for (const commit of features) {
139
- const releaseNote = yield getReleaseNoteLine(
140
- commit,
141
- customReleaseNoteFunction
142
- );
143
- console.info(releaseNote);
144
- }
145
- }
146
- if (bugFix.length) {
147
- console.info("## Bug Fix:\n");
148
- for (const commit of bugFix) {
149
- const relesaeNote = yield getReleaseNoteLine(
150
- commit,
151
- customReleaseNoteFunction
152
- );
153
- console.info(relesaeNote);
154
- }
155
- }
156
- });
157
- }
158
- export {
159
- genReleaseNote,
160
- getReleaseInfo,
161
- getReleaseNoteLine
162
- };
@@ -1,76 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import path from "path";
22
- import {
23
- getPackageManager,
24
- isMonorepo,
25
- fs,
26
- getPnpmVersion
27
- } from "@modern-js/utils";
28
- import { tag as gitTag } from "@changesets/git";
29
- import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
30
- function release(options) {
31
- return __async(this, null, function* () {
32
- const appDir = process.cwd();
33
- const packageManager = yield getPackageManager(process.cwd());
34
- const params = ["publish"];
35
- const { tag, otp, ignoreScripts, gitChecks } = options;
36
- if (tag) {
37
- params.push("--tag");
38
- params.push(tag);
39
- }
40
- if (otp) {
41
- params.push("--otp");
42
- params.push(otp);
43
- }
44
- if (!isMonorepo(appDir) || packageManager === "yarn" || packageManager === "npm") {
45
- yield execaWithStreamLog(process.execPath, [CHANGESET_PATH, ...params]);
46
- return;
47
- }
48
- params.push("-r");
49
- params.push("--filter");
50
- const pnpmVersion = yield getPnpmVersion();
51
- if (pnpmVersion.startsWith("6")) {
52
- params.push("./packages/");
53
- } else {
54
- params.push("{./packages/**}");
55
- }
56
- params.push("--report-summary");
57
- if (ignoreScripts) {
58
- params.push("--ignore-scripts");
59
- }
60
- if (!gitChecks) {
61
- params.push("--no-git-checks");
62
- }
63
- yield execaWithStreamLog(packageManager, params);
64
- const pnpmPublishSummaryFile = path.join(appDir, "pnpm-publish-summary.json");
65
- const publishInfo = yield fs.readJSON(pnpmPublishSummaryFile, "utf-8");
66
- yield Promise.all(
67
- (publishInfo.publishedPackages || []).map(
68
- (pkg) => gitTag(`${pkg.name}@${pkg.version}`, appDir)
69
- )
70
- );
71
- yield fs.remove(pnpmPublishSummaryFile);
72
- });
73
- }
74
- export {
75
- release
76
- };