@modern-js/plugin-changeset 2.22.1-beta.6 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/cjs/commands/release.js +0 -1
- package/dist/esm/commands/release.js +0 -1
- package/package.json +8 -7
- package/dist/js/modern/commands/bump.js +0 -66
- package/dist/js/modern/commands/change.js +0 -57
- package/dist/js/modern/commands/index.js +0 -6
- package/dist/js/modern/commands/pre.js +0 -33
- package/dist/js/modern/commands/release-note.js +0 -162
- package/dist/js/modern/commands/release.js +0 -76
- package/dist/js/modern/commands/status.js +0 -42
- package/dist/js/modern/index.js +0 -53
- package/dist/js/modern/locale/en.js +0 -41
- package/dist/js/modern/locale/index.js +0 -9
- package/dist/js/modern/locale/zh.js +0 -41
- package/dist/js/modern/utils/changeset.js +0 -14
- package/dist/js/modern/utils/index.js +0 -2
- package/dist/js/modern/utils/language.js +0 -8
- package/dist/js/node/commands/bump.js +0 -89
- package/dist/js/node/commands/change.js +0 -75
- package/dist/js/node/commands/index.js +0 -22
- package/dist/js/node/commands/pre.js +0 -56
- package/dist/js/node/commands/release-note.js +0 -193
- package/dist/js/node/commands/release.js +0 -100
- package/dist/js/node/commands/status.js +0 -65
- package/dist/js/node/index.js +0 -75
- package/dist/js/node/locale/en.js +0 -64
- package/dist/js/node/locale/index.js +0 -33
- package/dist/js/node/locale/zh.js +0 -64
- package/dist/js/node/utils/changeset.js +0 -44
- package/dist/js/node/utils/index.js +0 -18
- package/dist/js/node/utils/language.js +0 -31
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const ZH_LOCALE = {
|
|
2
|
-
command: {
|
|
3
|
-
change: {
|
|
4
|
-
describe: "创建变更集",
|
|
5
|
-
empty: "创建空变更集",
|
|
6
|
-
open: "使用编辑器中打开创建的变更集",
|
|
7
|
-
no_packages: "未找到子项目,请先执行 「{packageManager} new」 命令创建子项目"
|
|
8
|
-
},
|
|
9
|
-
bump: {
|
|
10
|
-
describe: "使用变更集自动更新发布版本和变更日志",
|
|
11
|
-
canary: "创建一个预发布版本进行测试",
|
|
12
|
-
preid: "在对预发布版本进行版本控制时指定标识符",
|
|
13
|
-
snapshot: "创建一个快照版本进行测试",
|
|
14
|
-
ignore: "跳过部分包发布版本"
|
|
15
|
-
},
|
|
16
|
-
pre: {
|
|
17
|
-
describe: "进入和退出预发布模式"
|
|
18
|
-
},
|
|
19
|
-
release: {
|
|
20
|
-
describe: "发布 npm 包",
|
|
21
|
-
tag: "发布 npm 包使用特定的 tag",
|
|
22
|
-
otp: "发布 npm 包的一次性 token,该 token 需要写权限",
|
|
23
|
-
ignore_scripts: "发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用",
|
|
24
|
-
no_git_checks: "发布命令忽略检查当前分支是否是发布分支,干净且最新,仅支持在 pnpm monorepo 中使用"
|
|
25
|
-
},
|
|
26
|
-
status: {
|
|
27
|
-
describe: "展示当前存在的变更集的状态信息",
|
|
28
|
-
verbose: "使用表格展示当前存在的变更集状态信息,包含变更集文件名称",
|
|
29
|
-
output: "将当前存在的变更集状态信息导出为 JSON 文件",
|
|
30
|
-
since: "展示基于指定分支或者 tag 的变更集状态信息"
|
|
31
|
-
},
|
|
32
|
-
gen_release_note: {
|
|
33
|
-
describe: "根据当前仓库 changeset 文件生成 Release Note",
|
|
34
|
-
repo: "仓库名称,用于生成 Pull Request 链接, 例如: modern-js-dev/modern.js",
|
|
35
|
-
custom: "自定义 Release Note 生成函数"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
ZH_LOCALE
|
|
41
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { execa } from "@modern-js/utils";
|
|
2
|
-
const CHANGESET_PATH = require.resolve("@changesets/cli");
|
|
3
|
-
function execaWithStreamLog(command, args) {
|
|
4
|
-
const promise = execa(command, args, {
|
|
5
|
-
stdin: "inherit",
|
|
6
|
-
stdout: "inherit",
|
|
7
|
-
stderr: "inherit"
|
|
8
|
-
});
|
|
9
|
-
return promise;
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
CHANGESET_PATH,
|
|
13
|
-
execaWithStreamLog
|
|
14
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
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 __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
|
-
var bump_exports = {};
|
|
39
|
-
__export(bump_exports, {
|
|
40
|
-
bump: () => bump
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(bump_exports);
|
|
43
|
-
var import_utils = require("../utils");
|
|
44
|
-
function bump(options) {
|
|
45
|
-
return __async(this, null, function* () {
|
|
46
|
-
const { snapshot, canary, preid, ignore } = options;
|
|
47
|
-
const params = [import_utils.CHANGESET_PATH, "version"];
|
|
48
|
-
if (snapshot) {
|
|
49
|
-
params.push("--snapshot");
|
|
50
|
-
if (typeof snapshot === "string") {
|
|
51
|
-
params.push(snapshot);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (ignore) {
|
|
55
|
-
ignore.forEach((pkg) => {
|
|
56
|
-
params.push("--ignore");
|
|
57
|
-
params.push(pkg);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (canary) {
|
|
61
|
-
yield (0, import_utils.execaWithStreamLog)(process.execPath, [
|
|
62
|
-
import_utils.CHANGESET_PATH,
|
|
63
|
-
"pre",
|
|
64
|
-
"enter",
|
|
65
|
-
preid || "next"
|
|
66
|
-
]);
|
|
67
|
-
try {
|
|
68
|
-
yield (0, import_utils.execaWithStreamLog)(process.execPath, params);
|
|
69
|
-
yield (0, import_utils.execaWithStreamLog)(process.execPath, [
|
|
70
|
-
import_utils.CHANGESET_PATH,
|
|
71
|
-
"pre",
|
|
72
|
-
"exit"
|
|
73
|
-
]);
|
|
74
|
-
} catch (e) {
|
|
75
|
-
yield (0, import_utils.execaWithStreamLog)(process.execPath, [
|
|
76
|
-
import_utils.CHANGESET_PATH,
|
|
77
|
-
"pre",
|
|
78
|
-
"exit"
|
|
79
|
-
]);
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
yield (0, import_utils.execaWithStreamLog)(process.execPath, params);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
-
0 && (module.exports = {
|
|
88
|
-
bump
|
|
89
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
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 __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
|
-
var change_exports = {};
|
|
39
|
-
__export(change_exports, {
|
|
40
|
-
change: () => change
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(change_exports);
|
|
43
|
-
var import_utils = require("@modern-js/utils");
|
|
44
|
-
var import_utils2 = require("../utils");
|
|
45
|
-
var import_locale = require("../locale");
|
|
46
|
-
function change(options) {
|
|
47
|
-
return __async(this, null, function* () {
|
|
48
|
-
const appDir = process.cwd();
|
|
49
|
-
if ((0, import_utils.isMonorepo)(appDir)) {
|
|
50
|
-
const packages = (0, import_utils.getMonorepoPackages)(appDir);
|
|
51
|
-
if (packages.length === 0) {
|
|
52
|
-
const packageManager = yield (0, import_utils.getPackageManager)(appDir);
|
|
53
|
-
import_utils.logger.warn(
|
|
54
|
-
import_locale.i18n.t(import_locale.localeKeys.command.change.no_packages, {
|
|
55
|
-
packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const { empty, open } = options;
|
|
62
|
-
const params = [import_utils2.CHANGESET_PATH, "add"];
|
|
63
|
-
if (empty) {
|
|
64
|
-
params.push("--empty");
|
|
65
|
-
}
|
|
66
|
-
if (open) {
|
|
67
|
-
params.push("--open");
|
|
68
|
-
}
|
|
69
|
-
yield (0, import_utils2.execaWithStreamLog)(process.execPath, params);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
-
0 && (module.exports = {
|
|
74
|
-
change
|
|
75
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
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 commands_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(commands_exports);
|
|
17
|
-
__reExport(commands_exports, require("./change"), module.exports);
|
|
18
|
-
__reExport(commands_exports, require("./bump"), module.exports);
|
|
19
|
-
__reExport(commands_exports, require("./pre"), module.exports);
|
|
20
|
-
__reExport(commands_exports, require("./release"), module.exports);
|
|
21
|
-
__reExport(commands_exports, require("./status"), module.exports);
|
|
22
|
-
__reExport(commands_exports, require("./release-note"), module.exports);
|
|
@@ -1,56 +0,0 @@
|
|
|
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 __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
|
-
var pre_exports = {};
|
|
39
|
-
__export(pre_exports, {
|
|
40
|
-
pre: () => pre
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(pre_exports);
|
|
43
|
-
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
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
pre
|
|
56
|
-
});
|
|
@@ -1,193 +0,0 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var release_note_exports = {};
|
|
45
|
-
__export(release_note_exports, {
|
|
46
|
-
genReleaseNote: () => genReleaseNote,
|
|
47
|
-
getReleaseInfo: () => getReleaseInfo,
|
|
48
|
-
getReleaseNoteLine: () => getReleaseNoteLine
|
|
49
|
-
});
|
|
50
|
-
module.exports = __toCommonJS(release_note_exports);
|
|
51
|
-
var import_path = __toESM(require("path"));
|
|
52
|
-
var import_resolve_from = __toESM(require("resolve-from"));
|
|
53
|
-
var import_utils = require("@modern-js/utils");
|
|
54
|
-
var import_read = __toESM(require("@changesets/read"));
|
|
55
|
-
function getReleaseInfo(commit, commitObj) {
|
|
56
|
-
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
57
|
-
const [, message, author] = commit.split("--");
|
|
58
|
-
commitObj.author = author;
|
|
59
|
-
if ((message || commitObj.summary).match(commitRegex)) {
|
|
60
|
-
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
61
|
-
commitObj.pullRequestId = pullRequestId;
|
|
62
|
-
commitObj.message = messageShort.trim();
|
|
63
|
-
}
|
|
64
|
-
return commitObj;
|
|
65
|
-
}
|
|
66
|
-
function formatSummary(summary, pullRequestId) {
|
|
67
|
-
const [firstLine, ...futureLines] = summary.split("\n").map((l) => l.trimRight());
|
|
68
|
-
let returnVal = firstLine;
|
|
69
|
-
if (futureLines.length > 0) {
|
|
70
|
-
if (pullRequestId) {
|
|
71
|
-
returnVal = `
|
|
72
|
-
|
|
73
|
-
${returnVal}`;
|
|
74
|
-
} else {
|
|
75
|
-
returnVal = `
|
|
76
|
-
${returnVal}`;
|
|
77
|
-
}
|
|
78
|
-
returnVal += `
|
|
79
|
-
|
|
80
|
-
${futureLines.filter((l) => Boolean(l)).map((l) => l).join("\n\n")}`;
|
|
81
|
-
}
|
|
82
|
-
return returnVal;
|
|
83
|
-
}
|
|
84
|
-
function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
85
|
-
if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
|
|
86
|
-
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
87
|
-
}
|
|
88
|
-
const { repository, pullRequestId, summary } = commit;
|
|
89
|
-
if (pullRequestId && repository) {
|
|
90
|
-
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(
|
|
91
|
-
summary,
|
|
92
|
-
pullRequestId
|
|
93
|
-
)}
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
|
-
if (pullRequestId) {
|
|
97
|
-
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}
|
|
98
|
-
`;
|
|
99
|
-
}
|
|
100
|
-
return `${formatSummary(summary, pullRequestId)}
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
103
|
-
function genReleaseNote(options) {
|
|
104
|
-
return __async(this, null, function* () {
|
|
105
|
-
const cwd = process.cwd();
|
|
106
|
-
const { repo, custom } = options;
|
|
107
|
-
let repository = repo;
|
|
108
|
-
let customReleaseNoteFunction;
|
|
109
|
-
if (!repo) {
|
|
110
|
-
const pkg = yield import_utils.fs.readJSON(import_path.default.join(cwd, "package.json"));
|
|
111
|
-
({ repository } = pkg);
|
|
112
|
-
}
|
|
113
|
-
if (custom) {
|
|
114
|
-
let possibleReleaseNoteFunc;
|
|
115
|
-
const releasenotePath = (0, import_resolve_from.default)(cwd, custom);
|
|
116
|
-
possibleReleaseNoteFunc = require(releasenotePath);
|
|
117
|
-
if (possibleReleaseNoteFunc.default) {
|
|
118
|
-
possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
|
|
119
|
-
}
|
|
120
|
-
if (typeof possibleReleaseNoteFunc.getReleaseInfo === "function" && typeof possibleReleaseNoteFunc.getReleaseNoteLine === "function") {
|
|
121
|
-
customReleaseNoteFunction = possibleReleaseNoteFunc;
|
|
122
|
-
} else {
|
|
123
|
-
throw new Error("Could not resolve relesae note generation functions");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const changesets = yield (0, import_read.default)(cwd);
|
|
127
|
-
if (changesets.length === 0) {
|
|
128
|
-
console.warn("No unreleased changesets found.");
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
const features = [];
|
|
132
|
-
const bugFix = [];
|
|
133
|
-
for (const changeset of changesets) {
|
|
134
|
-
const { stdout } = yield (0, import_utils.execa)("git", [
|
|
135
|
-
"log",
|
|
136
|
-
"--pretty=format:%h--%s--%an",
|
|
137
|
-
`.changeset/${changeset.id}.md`
|
|
138
|
-
]);
|
|
139
|
-
const [id, message] = stdout.split("--");
|
|
140
|
-
let commitObj = {
|
|
141
|
-
id,
|
|
142
|
-
type: (message || changeset.summary).startsWith("fix") ? "fix" : "feature",
|
|
143
|
-
repository,
|
|
144
|
-
message: (message || changeset.summary).trim(),
|
|
145
|
-
summary: changeset.summary
|
|
146
|
-
};
|
|
147
|
-
if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
|
|
148
|
-
commitObj = yield customReleaseNoteFunction.getReleaseInfo(
|
|
149
|
-
stdout,
|
|
150
|
-
commitObj
|
|
151
|
-
);
|
|
152
|
-
} else {
|
|
153
|
-
commitObj = getReleaseInfo(stdout, commitObj);
|
|
154
|
-
}
|
|
155
|
-
if (commitObj.type === "fix") {
|
|
156
|
-
bugFix.push(commitObj);
|
|
157
|
-
} else {
|
|
158
|
-
features.push(commitObj);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (!features.length && !bugFix.length) {
|
|
162
|
-
console.warn(
|
|
163
|
-
"no release note found, you can run `pnpm run add` to add changeset"
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
if (features.length) {
|
|
167
|
-
console.info("## Features:\n");
|
|
168
|
-
for (const commit of features) {
|
|
169
|
-
const releaseNote = yield getReleaseNoteLine(
|
|
170
|
-
commit,
|
|
171
|
-
customReleaseNoteFunction
|
|
172
|
-
);
|
|
173
|
-
console.info(releaseNote);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (bugFix.length) {
|
|
177
|
-
console.info("## Bug Fix:\n");
|
|
178
|
-
for (const commit of bugFix) {
|
|
179
|
-
const relesaeNote = yield getReleaseNoteLine(
|
|
180
|
-
commit,
|
|
181
|
-
customReleaseNoteFunction
|
|
182
|
-
);
|
|
183
|
-
console.info(relesaeNote);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
-
0 && (module.exports = {
|
|
190
|
-
genReleaseNote,
|
|
191
|
-
getReleaseInfo,
|
|
192
|
-
getReleaseNoteLine
|
|
193
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var release_exports = {};
|
|
45
|
-
__export(release_exports, {
|
|
46
|
-
release: () => release
|
|
47
|
-
});
|
|
48
|
-
module.exports = __toCommonJS(release_exports);
|
|
49
|
-
var import_path = __toESM(require("path"));
|
|
50
|
-
var import_utils = require("@modern-js/utils");
|
|
51
|
-
var import_git = require("@changesets/git");
|
|
52
|
-
var import_utils2 = require("../utils");
|
|
53
|
-
function release(options) {
|
|
54
|
-
return __async(this, null, function* () {
|
|
55
|
-
const appDir = process.cwd();
|
|
56
|
-
const packageManager = yield (0, import_utils.getPackageManager)(process.cwd());
|
|
57
|
-
const params = ["publish"];
|
|
58
|
-
const { tag, otp, ignoreScripts, gitChecks } = options;
|
|
59
|
-
if (tag) {
|
|
60
|
-
params.push("--tag");
|
|
61
|
-
params.push(tag);
|
|
62
|
-
}
|
|
63
|
-
if (otp) {
|
|
64
|
-
params.push("--otp");
|
|
65
|
-
params.push(otp);
|
|
66
|
-
}
|
|
67
|
-
if (!(0, import_utils.isMonorepo)(appDir) || packageManager === "yarn" || packageManager === "npm") {
|
|
68
|
-
yield (0, import_utils2.execaWithStreamLog)(process.execPath, [import_utils2.CHANGESET_PATH, ...params]);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
params.push("-r");
|
|
72
|
-
params.push("--filter");
|
|
73
|
-
const pnpmVersion = yield (0, import_utils.getPnpmVersion)();
|
|
74
|
-
if (pnpmVersion.startsWith("6")) {
|
|
75
|
-
params.push("./packages/");
|
|
76
|
-
} else {
|
|
77
|
-
params.push("{./packages/**}");
|
|
78
|
-
}
|
|
79
|
-
params.push("--report-summary");
|
|
80
|
-
if (ignoreScripts) {
|
|
81
|
-
params.push("--ignore-scripts");
|
|
82
|
-
}
|
|
83
|
-
if (!gitChecks) {
|
|
84
|
-
params.push("--no-git-checks");
|
|
85
|
-
}
|
|
86
|
-
yield (0, import_utils2.execaWithStreamLog)(packageManager, params);
|
|
87
|
-
const pnpmPublishSummaryFile = import_path.default.join(appDir, "pnpm-publish-summary.json");
|
|
88
|
-
const publishInfo = yield import_utils.fs.readJSON(pnpmPublishSummaryFile, "utf-8");
|
|
89
|
-
yield Promise.all(
|
|
90
|
-
(publishInfo.publishedPackages || []).map(
|
|
91
|
-
(pkg) => (0, import_git.tag)(`${pkg.name}@${pkg.version}`, appDir)
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
yield import_utils.fs.remove(pnpmPublishSummaryFile);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
-
0 && (module.exports = {
|
|
99
|
-
release
|
|
100
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
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 __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
|
-
var status_exports = {};
|
|
39
|
-
__export(status_exports, {
|
|
40
|
-
status: () => status
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(status_exports);
|
|
43
|
-
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
|
-
});
|
|
61
|
-
}
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
status
|
|
65
|
-
});
|