@modern-js/plugin-changeset 2.15.0 → 2.16.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/dist/cjs/index.js CHANGED
@@ -1,77 +1,47 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var src_exports = {};
20
- __export(src_exports, {
21
- default: () => src_default
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: () => _default
22
8
  });
23
- module.exports = __toCommonJS(src_exports);
24
- var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
25
- var import_commands = require("./commands");
26
- var import_locale = require("./locale");
27
- __reExport(src_exports, require("./commands"), module.exports);
28
- var src_default = () => ({
9
+ const _languagedetector = require("@modern-js/plugin-i18n/language-detector");
10
+ const _commands = _export_star(require("./commands"), exports);
11
+ const _locale = require("./locale");
12
+ function _export_star(from, to) {
13
+ Object.keys(from).forEach(function(k) {
14
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
15
+ Object.defineProperty(to, k, {
16
+ enumerable: true,
17
+ get: function() {
18
+ return from[k];
19
+ }
20
+ });
21
+ }
22
+ });
23
+ return from;
24
+ }
25
+ const _default = () => ({
29
26
  name: "@modern-js/plugin-changeset",
30
27
  setup: () => {
31
- import_locale.i18n.changeLanguage({ locale: (0, import_language_detector.getLocaleLanguage)() });
28
+ _locale.i18n.changeLanguage({
29
+ locale: (0, _languagedetector.getLocaleLanguage)()
30
+ });
32
31
  return {
33
32
  commands({ program }) {
34
- program.command("change").description(import_locale.i18n.t(import_locale.localeKeys.command.change.describe)).option("--empty", import_locale.i18n.t(import_locale.localeKeys.command.change.empty), false).option("--open", import_locale.i18n.t(import_locale.localeKeys.command.change.open), false).action((options) => (0, import_commands.change)(options));
35
- program.command("bump").description(import_locale.i18n.t(import_locale.localeKeys.command.bump.describe)).option("--canary", import_locale.i18n.t(import_locale.localeKeys.command.bump.canary), false).option(
36
- "--ignore <package>",
37
- import_locale.i18n.t(import_locale.localeKeys.command.bump.ignore),
38
- (val, memo) => {
39
- memo.push(val);
40
- return memo;
41
- },
42
- []
43
- ).option(
44
- "--preid <tag>",
45
- import_locale.i18n.t(import_locale.localeKeys.command.bump.preid),
46
- "next"
47
- ).option(
48
- "--snapshot [snapshot]",
49
- import_locale.i18n.t(import_locale.localeKeys.command.bump.snapshot),
50
- false
51
- ).action((options) => (0, import_commands.bump)(options));
52
- program.command("pre <enter|exit> [tag]").description(import_locale.i18n.t(import_locale.localeKeys.command.pre.describe)).action((type, tag) => (0, import_commands.pre)(type, tag));
53
- program.command("release").description(import_locale.i18n.t(import_locale.localeKeys.command.release.describe)).option("--tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.release.tag), "").option("--otp <token>", import_locale.i18n.t(import_locale.localeKeys.command.release.otp), "").option(
54
- "--ignore-scripts",
55
- import_locale.i18n.t(import_locale.localeKeys.command.release.ignore_scripts),
56
- ""
57
- ).option(
58
- "--no-git-checks",
59
- import_locale.i18n.t(import_locale.localeKeys.command.release.no_git_checks),
60
- ""
61
- ).action((options) => (0, import_commands.release)(options));
62
- program.command("change-status").description(import_locale.i18n.t(import_locale.localeKeys.command.status.describe)).option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.status.verbose)).option("--output <file>", import_locale.i18n.t(import_locale.localeKeys.command.status.output)).option("--since <ref>", import_locale.i18n.t(import_locale.localeKeys.command.status.since)).action((options) => (0, import_commands.status)(options));
63
- program.command("gen-release-note").description(import_locale.i18n.t(import_locale.localeKeys.command.gen_release_note.describe)).option(
64
- "--repo <repo>",
65
- import_locale.i18n.t(import_locale.localeKeys.command.gen_release_note.repo)
66
- ).option(
67
- "--custom <custom>",
68
- import_locale.i18n.t(import_locale.localeKeys.command.gen_release_note.custom)
69
- ).action(async (options) => {
70
- await (0, import_commands.genReleaseNote)(options);
33
+ program.command("change").description(_locale.i18n.t(_locale.localeKeys.command.change.describe)).option("--empty", _locale.i18n.t(_locale.localeKeys.command.change.empty), false).option("--open", _locale.i18n.t(_locale.localeKeys.command.change.open), false).action((options) => (0, _commands.change)(options));
34
+ program.command("bump").description(_locale.i18n.t(_locale.localeKeys.command.bump.describe)).option("--canary", _locale.i18n.t(_locale.localeKeys.command.bump.canary), false).option("--ignore <package>", _locale.i18n.t(_locale.localeKeys.command.bump.ignore), (val, memo) => {
35
+ memo.push(val);
36
+ return memo;
37
+ }, []).option("--preid <tag>", _locale.i18n.t(_locale.localeKeys.command.bump.preid), "next").option("--snapshot [snapshot]", _locale.i18n.t(_locale.localeKeys.command.bump.snapshot), false).action((options) => (0, _commands.bump)(options));
38
+ program.command("pre <enter|exit> [tag]").description(_locale.i18n.t(_locale.localeKeys.command.pre.describe)).action((type, tag) => (0, _commands.pre)(type, tag));
39
+ program.command("release").description(_locale.i18n.t(_locale.localeKeys.command.release.describe)).option("--tag <tag>", _locale.i18n.t(_locale.localeKeys.command.release.tag), "").option("--otp <token>", _locale.i18n.t(_locale.localeKeys.command.release.otp), "").option("--ignore-scripts", _locale.i18n.t(_locale.localeKeys.command.release.ignore_scripts), "").option("--no-git-checks", _locale.i18n.t(_locale.localeKeys.command.release.no_git_checks), "").action((options) => (0, _commands.release)(options));
40
+ program.command("change-status").description(_locale.i18n.t(_locale.localeKeys.command.status.describe)).option("--verbose", _locale.i18n.t(_locale.localeKeys.command.status.verbose)).option("--output <file>", _locale.i18n.t(_locale.localeKeys.command.status.output)).option("--since <ref>", _locale.i18n.t(_locale.localeKeys.command.status.since)).action((options) => (0, _commands.status)(options));
41
+ program.command("gen-release-note").description(_locale.i18n.t(_locale.localeKeys.command.gen_release_note.describe)).option("--repo <repo>", _locale.i18n.t(_locale.localeKeys.command.gen_release_note.repo)).option("--custom <custom>", _locale.i18n.t(_locale.localeKeys.command.gen_release_note.custom)).action(async (options) => {
42
+ await (0, _commands.genReleaseNote)(options);
71
43
  });
72
44
  }
73
45
  };
74
46
  }
75
47
  });
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {});
@@ -1,25 +1,11 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var en_exports = {};
19
- __export(en_exports, {
20
- EN_LOCALE: () => EN_LOCALE
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EN_LOCALE", {
6
+ enumerable: true,
7
+ get: () => EN_LOCALE
21
8
  });
22
- module.exports = __toCommonJS(en_exports);
23
9
  const EN_LOCALE = {
24
10
  command: {
25
11
  change: {
@@ -58,7 +44,3 @@ const EN_LOCALE = {
58
44
  }
59
45
  }
60
46
  };
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- EN_LOCALE
64
- });
@@ -1,33 +1,23 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
6
  for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var locale_exports = {};
19
- __export(locale_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
20
13
  i18n: () => i18n,
21
14
  localeKeys: () => localeKeys
22
15
  });
23
- module.exports = __toCommonJS(locale_exports);
24
- var import_plugin_i18n = require("@modern-js/plugin-i18n");
25
- var import_zh = require("./zh");
26
- var import_en = require("./en");
27
- const i18n = new import_plugin_i18n.I18n();
28
- const localeKeys = i18n.init("en", { zh: import_zh.ZH_LOCALE, en: import_en.EN_LOCALE });
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- i18n,
32
- localeKeys
16
+ const _plugini18n = require("@modern-js/plugin-i18n");
17
+ const _zh = require("./zh");
18
+ const _en = require("./en");
19
+ const i18n = new _plugini18n.I18n();
20
+ const localeKeys = i18n.init("en", {
21
+ zh: _zh.ZH_LOCALE,
22
+ en: _en.EN_LOCALE
33
23
  });
@@ -1,25 +1,11 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var zh_exports = {};
19
- __export(zh_exports, {
20
- ZH_LOCALE: () => ZH_LOCALE
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ZH_LOCALE", {
6
+ enumerable: true,
7
+ get: () => ZH_LOCALE
21
8
  });
22
- module.exports = __toCommonJS(zh_exports);
23
9
  const ZH_LOCALE = {
24
10
  command: {
25
11
  change: {
@@ -58,7 +44,3 @@ const ZH_LOCALE = {
58
44
  }
59
45
  }
60
46
  };
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- ZH_LOCALE
64
- });
@@ -1,48 +1,25 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var changeset_exports = {};
29
- __export(changeset_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
30
13
  CHANGESET_PATH: () => CHANGESET_PATH,
31
14
  execaWithStreamLog: () => execaWithStreamLog
32
15
  });
33
- module.exports = __toCommonJS(changeset_exports);
34
- var import_utils = require("@modern-js/utils");
16
+ const _utils = require("@modern-js/utils");
35
17
  const CHANGESET_PATH = require.resolve("@changesets/cli");
36
18
  function execaWithStreamLog(command, args) {
37
- const promise = (0, import_utils.execa)(command, args, {
19
+ const promise = (0, _utils.execa)(command, args, {
38
20
  stdin: "inherit",
39
21
  stdout: "inherit",
40
22
  stderr: "inherit"
41
23
  });
42
24
  return promise;
43
25
  }
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- CHANGESET_PATH,
47
- execaWithStreamLog
48
- });
@@ -1,17 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var utils_exports = {};
16
- module.exports = __toCommonJS(utils_exports);
17
- __reExport(utils_exports, require("./changeset"), module.exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./changeset"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
@@ -1,7 +1,10 @@
1
1
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
2
- async function bump(options) {
2
+ export async function bump(options) {
3
3
  const { snapshot, canary, preid, ignore } = options;
4
- const params = [CHANGESET_PATH, "version"];
4
+ const params = [
5
+ CHANGESET_PATH,
6
+ "version"
7
+ ];
5
8
  if (snapshot) {
6
9
  params.push("--snapshot");
7
10
  if (typeof snapshot === "string") {
@@ -39,6 +42,3 @@ async function bump(options) {
39
42
  await execaWithStreamLog(process.execPath, params);
40
43
  }
41
44
  }
42
- export {
43
- bump
44
- };
@@ -1,27 +1,23 @@
1
- import {
2
- isMonorepo,
3
- getMonorepoPackages,
4
- getPackageManager,
5
- logger
6
- } from "@modern-js/utils";
1
+ import { isMonorepo, getMonorepoPackages, getPackageManager, logger } from "@modern-js/utils";
7
2
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
8
3
  import { i18n, localeKeys } from "../locale";
9
- async function change(options) {
4
+ export async function change(options) {
10
5
  const appDir = process.cwd();
11
6
  if (isMonorepo(appDir)) {
12
7
  const packages = getMonorepoPackages(appDir);
13
8
  if (packages.length === 0) {
14
9
  const packageManager = await getPackageManager(appDir);
15
- logger.warn(
16
- i18n.t(localeKeys.command.change.no_packages, {
17
- packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
18
- })
19
- );
10
+ logger.warn(i18n.t(localeKeys.command.change.no_packages, {
11
+ packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
12
+ }));
20
13
  return;
21
14
  }
22
15
  }
23
16
  const { empty, open } = options;
24
- const params = [CHANGESET_PATH, "add"];
17
+ const params = [
18
+ CHANGESET_PATH,
19
+ "add"
20
+ ];
25
21
  if (empty) {
26
22
  params.push("--empty");
27
23
  }
@@ -30,6 +26,3 @@ async function change(options) {
30
26
  }
31
27
  await execaWithStreamLog(process.execPath, params);
32
28
  }
33
- export {
34
- change
35
- };
@@ -1,11 +1,12 @@
1
1
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
2
- async function pre(type, tag = "next") {
3
- const params = [CHANGESET_PATH, "pre", type];
2
+ export async function pre(type, tag = "next") {
3
+ const params = [
4
+ CHANGESET_PATH,
5
+ "pre",
6
+ type
7
+ ];
4
8
  if (type === "enter") {
5
9
  params.push(tag);
6
10
  }
7
11
  await execaWithStreamLog(process.execPath, params);
8
12
  }
9
- export {
10
- pre
11
- };
@@ -1,16 +1,13 @@
1
1
  import path from "path";
2
- import {
3
- getPackageManager,
4
- isMonorepo,
5
- fs,
6
- getPnpmVersion
7
- } from "@modern-js/utils";
2
+ import { getPackageManager, isMonorepo, fs, getPnpmVersion } from "@modern-js/utils";
8
3
  import { tag as gitTag } from "@changesets/git";
9
4
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
10
- async function release(options) {
5
+ export async function release(options) {
11
6
  const appDir = process.cwd();
12
7
  const packageManager = await getPackageManager(process.cwd());
13
- const params = ["publish"];
8
+ const params = [
9
+ "publish"
10
+ ];
14
11
  const { tag, otp, ignoreScripts, gitChecks } = options;
15
12
  if (tag) {
16
13
  params.push("--tag");
@@ -21,7 +18,10 @@ async function release(options) {
21
18
  params.push(otp);
22
19
  }
23
20
  if (!isMonorepo(appDir) || packageManager === "yarn" || packageManager === "npm") {
24
- await execaWithStreamLog(process.execPath, [CHANGESET_PATH, ...params]);
21
+ await execaWithStreamLog(process.execPath, [
22
+ CHANGESET_PATH,
23
+ ...params
24
+ ]);
25
25
  return;
26
26
  }
27
27
  params.push("-r");
@@ -42,13 +42,6 @@ async function release(options) {
42
42
  await execaWithStreamLog(packageManager, params);
43
43
  const pnpmPublishSummaryFile = path.join(appDir, "pnpm-publish-summary.json");
44
44
  const publishInfo = await fs.readJSON(pnpmPublishSummaryFile, "utf-8");
45
- await Promise.all(
46
- (publishInfo.publishedPackages || []).map(
47
- (pkg) => gitTag(`${pkg.name}@${pkg.version}`, appDir)
48
- )
49
- );
45
+ await Promise.all((publishInfo.publishedPackages || []).map((pkg) => gitTag(`${pkg.name}@${pkg.version}`, appDir)));
50
46
  await fs.remove(pnpmPublishSummaryFile);
51
47
  }
52
- export {
53
- release
54
- };
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import resolveFrom from "resolve-from";
3
3
  import { fs, execa } from "@modern-js/utils";
4
4
  import readChangesets from "@changesets/read";
5
- function getReleaseInfo(commit, commitObj) {
5
+ export function getReleaseInfo(commit, commitObj) {
6
6
  const commitRegex = /(.*)\(#(\d*)\)/;
7
7
  const [, message, author] = commit.split("--");
8
8
  commitObj.author = author;
@@ -31,16 +31,13 @@ function formatSummary(summary, pullRequestId) {
31
31
  }
32
32
  return returnVal;
33
33
  }
34
- function getReleaseNoteLine(commit, customReleaseNoteFunction) {
35
- if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
34
+ export function getReleaseNoteLine(commit, customReleaseNoteFunction) {
35
+ if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
36
36
  return customReleaseNoteFunction.getReleaseNoteLine(commit);
37
37
  }
38
38
  const { repository, pullRequestId, summary } = commit;
39
39
  if (pullRequestId && repository) {
40
- return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(
41
- summary,
42
- pullRequestId
43
- )}
40
+ return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(summary, pullRequestId)}
44
41
  `;
45
42
  }
46
43
  if (pullRequestId) {
@@ -50,7 +47,7 @@ function getReleaseNoteLine(commit, customReleaseNoteFunction) {
50
47
  return `${formatSummary(summary, pullRequestId)}
51
48
  `;
52
49
  }
53
- async function genReleaseNote(options) {
50
+ export async function genReleaseNote(options) {
54
51
  const cwd = process.cwd();
55
52
  const { repo, custom } = options;
56
53
  let repository = repo;
@@ -93,11 +90,8 @@ async function genReleaseNote(options) {
93
90
  message: (message || changeset.summary).trim(),
94
91
  summary: changeset.summary
95
92
  };
96
- if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
97
- commitObj = await customReleaseNoteFunction.getReleaseInfo(
98
- stdout,
99
- commitObj
100
- );
93
+ if (customReleaseNoteFunction === null || customReleaseNoteFunction === void 0 ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
94
+ commitObj = await customReleaseNoteFunction.getReleaseInfo(stdout, commitObj);
101
95
  } else {
102
96
  commitObj = getReleaseInfo(stdout, commitObj);
103
97
  }
@@ -108,36 +102,23 @@ async function genReleaseNote(options) {
108
102
  }
109
103
  }
110
104
  if (!features.length && !bugFix.length) {
111
- console.warn(
112
- "no release note found, you can run `pnpm run add` to add changeset"
113
- );
105
+ console.warn("no release note found, you can run `pnpm run add` to add changeset");
114
106
  }
115
107
  let result = "";
116
108
  if (features.length) {
117
109
  result += "## Features:\n";
118
110
  for (const commit of features) {
119
- const releaseNote = await getReleaseNoteLine(
120
- commit,
121
- customReleaseNoteFunction
122
- );
111
+ const releaseNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
123
112
  result += releaseNote;
124
113
  }
125
114
  }
126
115
  if (bugFix.length) {
127
116
  result += "## Bug Fix:\n";
128
117
  for (const commit of bugFix) {
129
- const releaseNote = await getReleaseNoteLine(
130
- commit,
131
- customReleaseNoteFunction
132
- );
118
+ const releaseNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
133
119
  result += releaseNote;
134
120
  }
135
121
  }
136
122
  console.info(result);
137
123
  return result;
138
124
  }
139
- export {
140
- genReleaseNote,
141
- getReleaseInfo,
142
- getReleaseNoteLine
143
- };
@@ -1,6 +1,9 @@
1
1
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
2
- async function status(options) {
3
- const params = [CHANGESET_PATH, "status"];
2
+ export async function status(options) {
3
+ const params = [
4
+ CHANGESET_PATH,
5
+ "status"
6
+ ];
4
7
  const { verbose, output, since } = options;
5
8
  if (verbose) {
6
9
  params.push("--verbose");
@@ -15,6 +18,3 @@ async function status(options) {
15
18
  }
16
19
  await execaWithStreamLog(process.execPath, params);
17
20
  }
18
- export {
19
- status
20
- };