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