@modern-js/plugin-changeset 2.4.1-beta.0 → 2.6.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 (40) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/dist/cjs/commands/bump.js +67 -0
  3. package/dist/cjs/commands/change.js +53 -0
  4. package/dist/{js/node → cjs}/commands/pre.js +6 -28
  5. package/dist/cjs/commands/release-note.js +175 -0
  6. package/dist/cjs/commands/release.js +82 -0
  7. package/dist/{js/node → cjs}/commands/status.js +15 -37
  8. package/dist/{js/node → cjs}/utils/changeset.js +4 -0
  9. package/dist/esm/commands/bump.js +44 -0
  10. package/dist/esm/commands/change.js +35 -0
  11. package/dist/esm/commands/pre.js +11 -0
  12. package/dist/esm/commands/release-note.js +140 -0
  13. package/dist/esm/commands/release.js +54 -0
  14. package/dist/esm/commands/status.js +20 -0
  15. package/package.json +11 -12
  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/pre.js +0 -33
  19. package/dist/js/modern/commands/release-note.js +0 -162
  20. package/dist/js/modern/commands/release.js +0 -76
  21. package/dist/js/modern/commands/status.js +0 -42
  22. package/dist/js/node/commands/bump.js +0 -89
  23. package/dist/js/node/commands/change.js +0 -75
  24. package/dist/js/node/commands/release-note.js +0 -193
  25. package/dist/js/node/commands/release.js +0 -100
  26. /package/dist/{js/node → cjs}/commands/index.js +0 -0
  27. /package/dist/{js/node → cjs}/index.js +0 -0
  28. /package/dist/{js/node → cjs}/locale/en.js +0 -0
  29. /package/dist/{js/node → cjs}/locale/index.js +0 -0
  30. /package/dist/{js/node → cjs}/locale/zh.js +0 -0
  31. /package/dist/{js/node → cjs}/utils/index.js +0 -0
  32. /package/dist/{js/node → cjs}/utils/language.js +0 -0
  33. /package/dist/{js/modern → esm}/commands/index.js +0 -0
  34. /package/dist/{js/modern → esm}/index.js +0 -0
  35. /package/dist/{js/modern → esm}/locale/en.js +0 -0
  36. /package/dist/{js/modern → esm}/locale/index.js +0 -0
  37. /package/dist/{js/modern → esm}/locale/zh.js +0 -0
  38. /package/dist/{js/modern → esm}/utils/changeset.js +0 -0
  39. /package/dist/{js/modern → esm}/utils/index.js +0 -0
  40. /package/dist/{js/modern → esm}/utils/language.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # @modern-js/plugin-changeset
2
2
 
3
- ## 2.4.1-beta.0
3
+ ## 2.6.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [e1f799e]
8
+ - Updated dependencies [7915ab3]
9
+ - Updated dependencies [0fe658a]
10
+ - @modern-js/utils@2.6.0
11
+ - @modern-js/plugin-i18n@2.6.0
12
+
13
+ ## 2.5.0
14
+
15
+ ### Patch Changes
16
+
17
+ - 89ca6cc: refactor: merge build-config into scripts/build
18
+
19
+ refactor: 把 build-config 合并进 scripts/build
20
+
21
+ - 30614fa: chore: modify package.json entry fields and build config
22
+ chore: 更改 package.json entry 字段以及构建配置
23
+ - Updated dependencies [89ca6cc]
24
+ - Updated dependencies [30614fa]
25
+ - Updated dependencies [1b0ce87]
7
26
  - Updated dependencies [11c053b]
8
- - @modern-js/utils@2.4.1-beta.0
9
- - @modern-js/plugin-i18n@2.4.1-beta.0
27
+ - @modern-js/plugin-i18n@2.5.0
28
+ - @modern-js/utils@2.5.0
10
29
 
11
30
  ## 2.4.0
12
31
 
@@ -0,0 +1,67 @@
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 bump_exports = {};
19
+ __export(bump_exports, {
20
+ bump: () => bump
21
+ });
22
+ module.exports = __toCommonJS(bump_exports);
23
+ var import_utils = require("../utils");
24
+ async function bump(options) {
25
+ const { snapshot, canary, preid, ignore } = options;
26
+ const params = [import_utils.CHANGESET_PATH, "version"];
27
+ if (snapshot) {
28
+ params.push("--snapshot");
29
+ if (typeof snapshot === "string") {
30
+ params.push(snapshot);
31
+ }
32
+ }
33
+ if (ignore) {
34
+ ignore.forEach((pkg) => {
35
+ params.push("--ignore");
36
+ params.push(pkg);
37
+ });
38
+ }
39
+ if (canary) {
40
+ await (0, import_utils.execaWithStreamLog)(process.execPath, [
41
+ import_utils.CHANGESET_PATH,
42
+ "pre",
43
+ "enter",
44
+ preid || "next"
45
+ ]);
46
+ try {
47
+ await (0, import_utils.execaWithStreamLog)(process.execPath, params);
48
+ await (0, import_utils.execaWithStreamLog)(process.execPath, [
49
+ import_utils.CHANGESET_PATH,
50
+ "pre",
51
+ "exit"
52
+ ]);
53
+ } catch (e) {
54
+ await (0, import_utils.execaWithStreamLog)(process.execPath, [
55
+ import_utils.CHANGESET_PATH,
56
+ "pre",
57
+ "exit"
58
+ ]);
59
+ }
60
+ } else {
61
+ await (0, import_utils.execaWithStreamLog)(process.execPath, params);
62
+ }
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ bump
67
+ });
@@ -0,0 +1,53 @@
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 change_exports = {};
19
+ __export(change_exports, {
20
+ change: () => change
21
+ });
22
+ module.exports = __toCommonJS(change_exports);
23
+ var import_utils = require("@modern-js/utils");
24
+ var import_utils2 = require("../utils");
25
+ var import_locale = require("../locale");
26
+ async function change(options) {
27
+ const appDir = process.cwd();
28
+ if ((0, import_utils.isMonorepo)(appDir)) {
29
+ const packages = (0, import_utils.getMonorepoPackages)(appDir);
30
+ if (packages.length === 0) {
31
+ const packageManager = await (0, import_utils.getPackageManager)(appDir);
32
+ import_utils.logger.warn(
33
+ import_locale.i18n.t(import_locale.localeKeys.command.change.no_packages, {
34
+ packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
35
+ })
36
+ );
37
+ return;
38
+ }
39
+ }
40
+ const { empty, open } = options;
41
+ const params = [import_utils2.CHANGESET_PATH, "add"];
42
+ if (empty) {
43
+ params.push("--empty");
44
+ }
45
+ if (open) {
46
+ params.push("--open");
47
+ }
48
+ await (0, import_utils2.execaWithStreamLog)(process.execPath, params);
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ change
53
+ });
@@ -15,40 +15,18 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
18
  var pre_exports = {};
39
19
  __export(pre_exports, {
40
20
  pre: () => pre
41
21
  });
42
22
  module.exports = __toCommonJS(pre_exports);
43
23
  var import_utils = require("../utils");
44
- function pre(type, tag = "next") {
45
- return __async(this, null, function* () {
46
- const params = [import_utils.CHANGESET_PATH, "pre", type];
47
- if (type === "enter") {
48
- params.push(tag);
49
- }
50
- yield (0, import_utils.execaWithStreamLog)(process.execPath, params);
51
- });
24
+ async function pre(type, tag = "next") {
25
+ const params = [import_utils.CHANGESET_PATH, "pre", type];
26
+ if (type === "enter") {
27
+ params.push(tag);
28
+ }
29
+ await (0, import_utils.execaWithStreamLog)(process.execPath, params);
52
30
  }
53
31
  // Annotate the CommonJS export names for ESM import in node:
54
32
  0 && (module.exports = {
@@ -0,0 +1,175 @@
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) => {
8
+ 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 release_note_exports = {};
29
+ __export(release_note_exports, {
30
+ genReleaseNote: () => genReleaseNote,
31
+ getReleaseInfo: () => getReleaseInfo,
32
+ getReleaseNoteLine: () => getReleaseNoteLine
33
+ });
34
+ module.exports = __toCommonJS(release_note_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_resolve_from = __toESM(require("resolve-from"));
37
+ var import_utils = require("@modern-js/utils");
38
+ var import_read = __toESM(require("@changesets/read"));
39
+ function getReleaseInfo(commit, commitObj) {
40
+ const commitRegex = /(.*)\(#(\d*)\)/;
41
+ const [, message, author] = commit.split("--");
42
+ commitObj.author = author;
43
+ if ((message || commitObj.summary).match(commitRegex)) {
44
+ const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
45
+ commitObj.pullRequestId = pullRequestId;
46
+ commitObj.message = messageShort.trim();
47
+ }
48
+ return commitObj;
49
+ }
50
+ function formatSummary(summary, pullRequestId) {
51
+ const [firstLine, ...futureLines] = summary.split("\n").map((l) => l.trimRight());
52
+ let returnVal = firstLine;
53
+ if (futureLines.length > 0) {
54
+ if (pullRequestId) {
55
+ returnVal = `
56
+
57
+ ${returnVal}`;
58
+ } else {
59
+ returnVal = `
60
+ ${returnVal}`;
61
+ }
62
+ returnVal += `
63
+
64
+ ${futureLines.filter((l) => Boolean(l)).map((l) => l).join("\n\n")}`;
65
+ }
66
+ return returnVal;
67
+ }
68
+ function getReleaseNoteLine(commit, customReleaseNoteFunction) {
69
+ if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
70
+ return customReleaseNoteFunction.getReleaseNoteLine(commit);
71
+ }
72
+ const { repository, pullRequestId, summary } = commit;
73
+ if (pullRequestId && repository) {
74
+ return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(
75
+ summary,
76
+ pullRequestId
77
+ )}
78
+ `;
79
+ }
80
+ if (pullRequestId) {
81
+ return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}
82
+ `;
83
+ }
84
+ return `${formatSummary(summary, pullRequestId)}
85
+ `;
86
+ }
87
+ async function genReleaseNote(options) {
88
+ const cwd = process.cwd();
89
+ const { repo, custom } = options;
90
+ let repository = repo;
91
+ let customReleaseNoteFunction;
92
+ if (!repo) {
93
+ const pkg = await import_utils.fs.readJSON(import_path.default.join(cwd, "package.json"));
94
+ ({ repository } = pkg);
95
+ }
96
+ if (custom) {
97
+ let possibleReleaseNoteFunc;
98
+ const releasenotePath = (0, import_resolve_from.default)(cwd, custom);
99
+ possibleReleaseNoteFunc = require(releasenotePath);
100
+ if (possibleReleaseNoteFunc.default) {
101
+ possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
102
+ }
103
+ if (typeof possibleReleaseNoteFunc.getReleaseInfo === "function" && typeof possibleReleaseNoteFunc.getReleaseNoteLine === "function") {
104
+ customReleaseNoteFunction = possibleReleaseNoteFunc;
105
+ } else {
106
+ throw new Error("Could not resolve relesae note generation functions");
107
+ }
108
+ }
109
+ const changesets = await (0, import_read.default)(cwd);
110
+ if (changesets.length === 0) {
111
+ console.warn("No unreleased changesets found.");
112
+ process.exit(1);
113
+ }
114
+ const features = [];
115
+ const bugFix = [];
116
+ for (const changeset of changesets) {
117
+ const { stdout } = await (0, import_utils.execa)("git", [
118
+ "log",
119
+ "--pretty=format:%h--%s--%an",
120
+ `.changeset/${changeset.id}.md`
121
+ ]);
122
+ const [id, message] = stdout.split("--");
123
+ let commitObj = {
124
+ id,
125
+ type: (message || changeset.summary).startsWith("fix") ? "fix" : "feature",
126
+ repository,
127
+ message: (message || changeset.summary).trim(),
128
+ summary: changeset.summary
129
+ };
130
+ if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
131
+ commitObj = await customReleaseNoteFunction.getReleaseInfo(
132
+ stdout,
133
+ commitObj
134
+ );
135
+ } else {
136
+ commitObj = getReleaseInfo(stdout, commitObj);
137
+ }
138
+ if (commitObj.type === "fix") {
139
+ bugFix.push(commitObj);
140
+ } else {
141
+ features.push(commitObj);
142
+ }
143
+ }
144
+ if (!features.length && !bugFix.length) {
145
+ console.warn(
146
+ "no release note found, you can run `pnpm run add` to add changeset"
147
+ );
148
+ }
149
+ if (features.length) {
150
+ console.info("## Features:\n");
151
+ for (const commit of features) {
152
+ const releaseNote = await getReleaseNoteLine(
153
+ commit,
154
+ customReleaseNoteFunction
155
+ );
156
+ console.info(releaseNote);
157
+ }
158
+ }
159
+ if (bugFix.length) {
160
+ console.info("## Bug Fix:\n");
161
+ for (const commit of bugFix) {
162
+ const relesaeNote = await getReleaseNoteLine(
163
+ commit,
164
+ customReleaseNoteFunction
165
+ );
166
+ console.info(relesaeNote);
167
+ }
168
+ }
169
+ }
170
+ // Annotate the CommonJS export names for ESM import in node:
171
+ 0 && (module.exports = {
172
+ genReleaseNote,
173
+ getReleaseInfo,
174
+ getReleaseNoteLine
175
+ });
@@ -0,0 +1,82 @@
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) => {
8
+ 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 release_exports = {};
29
+ __export(release_exports, {
30
+ release: () => release
31
+ });
32
+ module.exports = __toCommonJS(release_exports);
33
+ var import_path = __toESM(require("path"));
34
+ var import_utils = require("@modern-js/utils");
35
+ var import_git = require("@changesets/git");
36
+ var import_utils2 = require("../utils");
37
+ async function release(options) {
38
+ const appDir = process.cwd();
39
+ const packageManager = await (0, import_utils.getPackageManager)(process.cwd());
40
+ const params = ["publish"];
41
+ const { tag, otp, ignoreScripts, gitChecks } = options;
42
+ if (tag) {
43
+ params.push("--tag");
44
+ params.push(tag);
45
+ }
46
+ if (otp) {
47
+ params.push("--otp");
48
+ params.push(otp);
49
+ }
50
+ if (!(0, import_utils.isMonorepo)(appDir) || packageManager === "yarn" || packageManager === "npm") {
51
+ await (0, import_utils2.execaWithStreamLog)(process.execPath, [import_utils2.CHANGESET_PATH, ...params]);
52
+ return;
53
+ }
54
+ params.push("-r");
55
+ params.push("--filter");
56
+ const pnpmVersion = await (0, import_utils.getPnpmVersion)();
57
+ if (pnpmVersion.startsWith("6")) {
58
+ params.push("./packages/");
59
+ } else {
60
+ params.push("{./packages/**}");
61
+ }
62
+ params.push("--report-summary");
63
+ if (ignoreScripts) {
64
+ params.push("--ignore-scripts");
65
+ }
66
+ if (!gitChecks) {
67
+ params.push("--no-git-checks");
68
+ }
69
+ await (0, import_utils2.execaWithStreamLog)(packageManager, params);
70
+ const pnpmPublishSummaryFile = import_path.default.join(appDir, "pnpm-publish-summary.json");
71
+ const publishInfo = await import_utils.fs.readJSON(pnpmPublishSummaryFile, "utf-8");
72
+ await Promise.all(
73
+ (publishInfo.publishedPackages || []).map(
74
+ (pkg) => (0, import_git.tag)(`${pkg.name}@${pkg.version}`, appDir)
75
+ )
76
+ );
77
+ await import_utils.fs.remove(pnpmPublishSummaryFile);
78
+ }
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ release
82
+ });
@@ -15,49 +15,27 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
18
  var status_exports = {};
39
19
  __export(status_exports, {
40
20
  status: () => status
41
21
  });
42
22
  module.exports = __toCommonJS(status_exports);
43
23
  var import_utils = require("../utils");
44
- function status(options) {
45
- return __async(this, null, function* () {
46
- const params = [import_utils.CHANGESET_PATH, "status"];
47
- const { verbose, output, since } = options;
48
- if (verbose) {
49
- params.push("--verbose");
50
- }
51
- if (output) {
52
- params.push("--output");
53
- params.push(output);
54
- }
55
- if (since) {
56
- params.push("--since");
57
- params.push(since);
58
- }
59
- yield (0, import_utils.execaWithStreamLog)(process.execPath, params);
60
- });
24
+ async function status(options) {
25
+ const params = [import_utils.CHANGESET_PATH, "status"];
26
+ const { verbose, output, since } = options;
27
+ if (verbose) {
28
+ params.push("--verbose");
29
+ }
30
+ if (output) {
31
+ params.push("--output");
32
+ params.push(output);
33
+ }
34
+ if (since) {
35
+ params.push("--since");
36
+ params.push(since);
37
+ }
38
+ await (0, import_utils.execaWithStreamLog)(process.execPath, params);
61
39
  }
62
40
  // Annotate the CommonJS export names for ESM import in node:
63
41
  0 && (module.exports = {
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
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.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -0,0 +1,44 @@
1
+ import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
2
+ async function bump(options) {
3
+ const { snapshot, canary, preid, ignore } = options;
4
+ const params = [CHANGESET_PATH, "version"];
5
+ if (snapshot) {
6
+ params.push("--snapshot");
7
+ if (typeof snapshot === "string") {
8
+ params.push(snapshot);
9
+ }
10
+ }
11
+ if (ignore) {
12
+ ignore.forEach((pkg) => {
13
+ params.push("--ignore");
14
+ params.push(pkg);
15
+ });
16
+ }
17
+ if (canary) {
18
+ await execaWithStreamLog(process.execPath, [
19
+ CHANGESET_PATH,
20
+ "pre",
21
+ "enter",
22
+ preid || "next"
23
+ ]);
24
+ try {
25
+ await execaWithStreamLog(process.execPath, params);
26
+ await execaWithStreamLog(process.execPath, [
27
+ CHANGESET_PATH,
28
+ "pre",
29
+ "exit"
30
+ ]);
31
+ } catch (e) {
32
+ await execaWithStreamLog(process.execPath, [
33
+ CHANGESET_PATH,
34
+ "pre",
35
+ "exit"
36
+ ]);
37
+ }
38
+ } else {
39
+ await execaWithStreamLog(process.execPath, params);
40
+ }
41
+ }
42
+ export {
43
+ bump
44
+ };
@@ -0,0 +1,35 @@
1
+ import {
2
+ isMonorepo,
3
+ getMonorepoPackages,
4
+ getPackageManager,
5
+ logger
6
+ } from "@modern-js/utils";
7
+ import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
8
+ import { i18n, localeKeys } from "../locale";
9
+ async function change(options) {
10
+ const appDir = process.cwd();
11
+ if (isMonorepo(appDir)) {
12
+ const packages = getMonorepoPackages(appDir);
13
+ if (packages.length === 0) {
14
+ 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
+ );
20
+ return;
21
+ }
22
+ }
23
+ const { empty, open } = options;
24
+ const params = [CHANGESET_PATH, "add"];
25
+ if (empty) {
26
+ params.push("--empty");
27
+ }
28
+ if (open) {
29
+ params.push("--open");
30
+ }
31
+ await execaWithStreamLog(process.execPath, params);
32
+ }
33
+ export {
34
+ change
35
+ };
@@ -0,0 +1,11 @@
1
+ import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
2
+ async function pre(type, tag = "next") {
3
+ const params = [CHANGESET_PATH, "pre", type];
4
+ if (type === "enter") {
5
+ params.push(tag);
6
+ }
7
+ await execaWithStreamLog(process.execPath, params);
8
+ }
9
+ export {
10
+ pre
11
+ };