@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @modern-js/plugin-changeset
|
|
2
2
|
|
|
3
|
+
## 2.23.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7e6fb5f: chore: publishConfig add provenance config
|
|
8
|
+
|
|
9
|
+
chore: publishConfig 增加 provenance 配置
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7e6fb5f]
|
|
12
|
+
- Updated dependencies [a7a7ad7]
|
|
13
|
+
- Updated dependencies [6dec7c2]
|
|
14
|
+
- Updated dependencies [c3216b5]
|
|
15
|
+
- @modern-js/plugin-i18n@2.23.0
|
|
16
|
+
- @modern-js/utils@2.23.0
|
|
17
|
+
|
|
18
|
+
## 2.22.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- a2dd693: fix: release note get use not right
|
|
23
|
+
|
|
24
|
+
fix: 修复 Release Note 获取用户名称错误问题
|
|
25
|
+
|
|
26
|
+
- b904b3a: feat(plugin-changeset): release commad support --provenance params
|
|
27
|
+
|
|
28
|
+
feat(plugin-changeset): release 命令支持 --provenance 参数
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [e2848a2]
|
|
31
|
+
- Updated dependencies [d4045ed]
|
|
32
|
+
- @modern-js/utils@2.22.1
|
|
33
|
+
- @modern-js/plugin-i18n@2.22.1
|
|
34
|
+
|
|
3
35
|
## 2.22.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -57,7 +57,6 @@ async function release(options) {
|
|
|
57
57
|
params.push("--provenance");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
console.info("==release params", params);
|
|
61
60
|
await (0, _utils1.execaWithStreamLog)(packageManager, params);
|
|
62
61
|
const pnpmPublishSummaryFile = _path.default.join(appDir, "pnpm-publish-summary.json");
|
|
63
62
|
const publishInfo = await _utils.fs.readJSON(pnpmPublishSummaryFile, "utf-8");
|
|
@@ -46,7 +46,6 @@ export async function release(options) {
|
|
|
46
46
|
params.push("--provenance");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
console.info("==release params", params);
|
|
50
49
|
await execaWithStreamLog(packageManager, params);
|
|
51
50
|
const pnpmPublishSummaryFile = path.join(appDir, "pnpm-publish-summary.json");
|
|
52
51
|
const publishInfo = await fs.readJSON(pnpmPublishSummaryFile, "utf-8");
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.23.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -52,22 +52,23 @@
|
|
|
52
52
|
"resolve-from": "^5.0.0",
|
|
53
53
|
"axios": "^1.2.1",
|
|
54
54
|
"@swc/helpers": "0.5.1",
|
|
55
|
-
"@modern-js/plugin-i18n": "2.
|
|
56
|
-
"@modern-js/utils": "2.
|
|
55
|
+
"@modern-js/plugin-i18n": "2.23.0",
|
|
56
|
+
"@modern-js/utils": "2.23.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/jest": "^29",
|
|
60
60
|
"@types/node": "^14",
|
|
61
61
|
"typescript": "^5",
|
|
62
62
|
"jest": "^29",
|
|
63
|
-
"@modern-js/core": "2.
|
|
64
|
-
"@scripts/
|
|
65
|
-
"@scripts/
|
|
63
|
+
"@modern-js/core": "2.23.0",
|
|
64
|
+
"@scripts/build": "2.23.0",
|
|
65
|
+
"@scripts/jest-config": "2.23.0"
|
|
66
66
|
},
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://registry.npmjs.org/",
|
|
70
|
-
"access": "public"
|
|
70
|
+
"access": "public",
|
|
71
|
+
"provenance": true
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
73
74
|
"new": "modern-lib new",
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
22
|
-
function bump(options) {
|
|
23
|
-
return __async(this, null, function* () {
|
|
24
|
-
const { snapshot, canary, preid, ignore } = options;
|
|
25
|
-
const params = [CHANGESET_PATH, "version"];
|
|
26
|
-
if (snapshot) {
|
|
27
|
-
params.push("--snapshot");
|
|
28
|
-
if (typeof snapshot === "string") {
|
|
29
|
-
params.push(snapshot);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (ignore) {
|
|
33
|
-
ignore.forEach((pkg) => {
|
|
34
|
-
params.push("--ignore");
|
|
35
|
-
params.push(pkg);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
if (canary) {
|
|
39
|
-
yield execaWithStreamLog(process.execPath, [
|
|
40
|
-
CHANGESET_PATH,
|
|
41
|
-
"pre",
|
|
42
|
-
"enter",
|
|
43
|
-
preid || "next"
|
|
44
|
-
]);
|
|
45
|
-
try {
|
|
46
|
-
yield execaWithStreamLog(process.execPath, params);
|
|
47
|
-
yield execaWithStreamLog(process.execPath, [
|
|
48
|
-
CHANGESET_PATH,
|
|
49
|
-
"pre",
|
|
50
|
-
"exit"
|
|
51
|
-
]);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
yield execaWithStreamLog(process.execPath, [
|
|
54
|
-
CHANGESET_PATH,
|
|
55
|
-
"pre",
|
|
56
|
-
"exit"
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
yield execaWithStreamLog(process.execPath, params);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
bump
|
|
66
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import {
|
|
22
|
-
isMonorepo,
|
|
23
|
-
getMonorepoPackages,
|
|
24
|
-
getPackageManager,
|
|
25
|
-
logger
|
|
26
|
-
} from "@modern-js/utils";
|
|
27
|
-
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
28
|
-
import { i18n, localeKeys } from "../locale";
|
|
29
|
-
function change(options) {
|
|
30
|
-
return __async(this, null, function* () {
|
|
31
|
-
const appDir = process.cwd();
|
|
32
|
-
if (isMonorepo(appDir)) {
|
|
33
|
-
const packages = getMonorepoPackages(appDir);
|
|
34
|
-
if (packages.length === 0) {
|
|
35
|
-
const packageManager = yield getPackageManager(appDir);
|
|
36
|
-
logger.warn(
|
|
37
|
-
i18n.t(localeKeys.command.change.no_packages, {
|
|
38
|
-
packageManager: packageManager === "yarn" ? "yarn" : `${packageManager} run`
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const { empty, open } = options;
|
|
45
|
-
const params = [CHANGESET_PATH, "add"];
|
|
46
|
-
if (empty) {
|
|
47
|
-
params.push("--empty");
|
|
48
|
-
}
|
|
49
|
-
if (open) {
|
|
50
|
-
params.push("--open");
|
|
51
|
-
}
|
|
52
|
-
yield execaWithStreamLog(process.execPath, params);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
change
|
|
57
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
22
|
-
function pre(type, tag = "next") {
|
|
23
|
-
return __async(this, null, function* () {
|
|
24
|
-
const params = [CHANGESET_PATH, "pre", type];
|
|
25
|
-
if (type === "enter") {
|
|
26
|
-
params.push(tag);
|
|
27
|
-
}
|
|
28
|
-
yield execaWithStreamLog(process.execPath, params);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
pre
|
|
33
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import path from "path";
|
|
22
|
-
import resolveFrom from "resolve-from";
|
|
23
|
-
import { fs, execa } from "@modern-js/utils";
|
|
24
|
-
import readChangesets from "@changesets/read";
|
|
25
|
-
function getReleaseInfo(commit, commitObj) {
|
|
26
|
-
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
27
|
-
const [, message, author] = commit.split("--");
|
|
28
|
-
commitObj.author = author;
|
|
29
|
-
if ((message || commitObj.summary).match(commitRegex)) {
|
|
30
|
-
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
31
|
-
commitObj.pullRequestId = pullRequestId;
|
|
32
|
-
commitObj.message = messageShort.trim();
|
|
33
|
-
}
|
|
34
|
-
return commitObj;
|
|
35
|
-
}
|
|
36
|
-
function formatSummary(summary, pullRequestId) {
|
|
37
|
-
const [firstLine, ...futureLines] = summary.split("\n").map((l) => l.trimRight());
|
|
38
|
-
let returnVal = firstLine;
|
|
39
|
-
if (futureLines.length > 0) {
|
|
40
|
-
if (pullRequestId) {
|
|
41
|
-
returnVal = `
|
|
42
|
-
|
|
43
|
-
${returnVal}`;
|
|
44
|
-
} else {
|
|
45
|
-
returnVal = `
|
|
46
|
-
${returnVal}`;
|
|
47
|
-
}
|
|
48
|
-
returnVal += `
|
|
49
|
-
|
|
50
|
-
${futureLines.filter((l) => Boolean(l)).map((l) => l).join("\n\n")}`;
|
|
51
|
-
}
|
|
52
|
-
return returnVal;
|
|
53
|
-
}
|
|
54
|
-
function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
55
|
-
if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseNoteLine) {
|
|
56
|
-
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
57
|
-
}
|
|
58
|
-
const { repository, pullRequestId, summary } = commit;
|
|
59
|
-
if (pullRequestId && repository) {
|
|
60
|
-
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(
|
|
61
|
-
summary,
|
|
62
|
-
pullRequestId
|
|
63
|
-
)}
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
66
|
-
if (pullRequestId) {
|
|
67
|
-
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
return `${formatSummary(summary, pullRequestId)}
|
|
71
|
-
`;
|
|
72
|
-
}
|
|
73
|
-
function genReleaseNote(options) {
|
|
74
|
-
return __async(this, null, function* () {
|
|
75
|
-
const cwd = process.cwd();
|
|
76
|
-
const { repo, custom } = options;
|
|
77
|
-
let repository = repo;
|
|
78
|
-
let customReleaseNoteFunction;
|
|
79
|
-
if (!repo) {
|
|
80
|
-
const pkg = yield fs.readJSON(path.join(cwd, "package.json"));
|
|
81
|
-
({ repository } = pkg);
|
|
82
|
-
}
|
|
83
|
-
if (custom) {
|
|
84
|
-
let possibleReleaseNoteFunc;
|
|
85
|
-
const releasenotePath = resolveFrom(cwd, custom);
|
|
86
|
-
possibleReleaseNoteFunc = require(releasenotePath);
|
|
87
|
-
if (possibleReleaseNoteFunc.default) {
|
|
88
|
-
possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
|
|
89
|
-
}
|
|
90
|
-
if (typeof possibleReleaseNoteFunc.getReleaseInfo === "function" && typeof possibleReleaseNoteFunc.getReleaseNoteLine === "function") {
|
|
91
|
-
customReleaseNoteFunction = possibleReleaseNoteFunc;
|
|
92
|
-
} else {
|
|
93
|
-
throw new Error("Could not resolve relesae note generation functions");
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
const changesets = yield readChangesets(cwd);
|
|
97
|
-
if (changesets.length === 0) {
|
|
98
|
-
console.warn("No unreleased changesets found.");
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
const features = [];
|
|
102
|
-
const bugFix = [];
|
|
103
|
-
for (const changeset of changesets) {
|
|
104
|
-
const { stdout } = yield execa("git", [
|
|
105
|
-
"log",
|
|
106
|
-
"--pretty=format:%h--%s--%an",
|
|
107
|
-
`.changeset/${changeset.id}.md`
|
|
108
|
-
]);
|
|
109
|
-
const [id, message] = stdout.split("--");
|
|
110
|
-
let commitObj = {
|
|
111
|
-
id,
|
|
112
|
-
type: (message || changeset.summary).startsWith("fix") ? "fix" : "feature",
|
|
113
|
-
repository,
|
|
114
|
-
message: (message || changeset.summary).trim(),
|
|
115
|
-
summary: changeset.summary
|
|
116
|
-
};
|
|
117
|
-
if (customReleaseNoteFunction == null ? void 0 : customReleaseNoteFunction.getReleaseInfo) {
|
|
118
|
-
commitObj = yield customReleaseNoteFunction.getReleaseInfo(
|
|
119
|
-
stdout,
|
|
120
|
-
commitObj
|
|
121
|
-
);
|
|
122
|
-
} else {
|
|
123
|
-
commitObj = getReleaseInfo(stdout, commitObj);
|
|
124
|
-
}
|
|
125
|
-
if (commitObj.type === "fix") {
|
|
126
|
-
bugFix.push(commitObj);
|
|
127
|
-
} else {
|
|
128
|
-
features.push(commitObj);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (!features.length && !bugFix.length) {
|
|
132
|
-
console.warn(
|
|
133
|
-
"no release note found, you can run `pnpm run add` to add changeset"
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
if (features.length) {
|
|
137
|
-
console.info("## Features:\n");
|
|
138
|
-
for (const commit of features) {
|
|
139
|
-
const releaseNote = yield getReleaseNoteLine(
|
|
140
|
-
commit,
|
|
141
|
-
customReleaseNoteFunction
|
|
142
|
-
);
|
|
143
|
-
console.info(releaseNote);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (bugFix.length) {
|
|
147
|
-
console.info("## Bug Fix:\n");
|
|
148
|
-
for (const commit of bugFix) {
|
|
149
|
-
const relesaeNote = yield getReleaseNoteLine(
|
|
150
|
-
commit,
|
|
151
|
-
customReleaseNoteFunction
|
|
152
|
-
);
|
|
153
|
-
console.info(relesaeNote);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
export {
|
|
159
|
-
genReleaseNote,
|
|
160
|
-
getReleaseInfo,
|
|
161
|
-
getReleaseNoteLine
|
|
162
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import path from "path";
|
|
22
|
-
import {
|
|
23
|
-
getPackageManager,
|
|
24
|
-
isMonorepo,
|
|
25
|
-
fs,
|
|
26
|
-
getPnpmVersion
|
|
27
|
-
} from "@modern-js/utils";
|
|
28
|
-
import { tag as gitTag } from "@changesets/git";
|
|
29
|
-
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
30
|
-
function release(options) {
|
|
31
|
-
return __async(this, null, function* () {
|
|
32
|
-
const appDir = process.cwd();
|
|
33
|
-
const packageManager = yield getPackageManager(process.cwd());
|
|
34
|
-
const params = ["publish"];
|
|
35
|
-
const { tag, otp, ignoreScripts, gitChecks } = options;
|
|
36
|
-
if (tag) {
|
|
37
|
-
params.push("--tag");
|
|
38
|
-
params.push(tag);
|
|
39
|
-
}
|
|
40
|
-
if (otp) {
|
|
41
|
-
params.push("--otp");
|
|
42
|
-
params.push(otp);
|
|
43
|
-
}
|
|
44
|
-
if (!isMonorepo(appDir) || packageManager === "yarn" || packageManager === "npm") {
|
|
45
|
-
yield execaWithStreamLog(process.execPath, [CHANGESET_PATH, ...params]);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
params.push("-r");
|
|
49
|
-
params.push("--filter");
|
|
50
|
-
const pnpmVersion = yield getPnpmVersion();
|
|
51
|
-
if (pnpmVersion.startsWith("6")) {
|
|
52
|
-
params.push("./packages/");
|
|
53
|
-
} else {
|
|
54
|
-
params.push("{./packages/**}");
|
|
55
|
-
}
|
|
56
|
-
params.push("--report-summary");
|
|
57
|
-
if (ignoreScripts) {
|
|
58
|
-
params.push("--ignore-scripts");
|
|
59
|
-
}
|
|
60
|
-
if (!gitChecks) {
|
|
61
|
-
params.push("--no-git-checks");
|
|
62
|
-
}
|
|
63
|
-
yield execaWithStreamLog(packageManager, params);
|
|
64
|
-
const pnpmPublishSummaryFile = path.join(appDir, "pnpm-publish-summary.json");
|
|
65
|
-
const publishInfo = yield fs.readJSON(pnpmPublishSummaryFile, "utf-8");
|
|
66
|
-
yield Promise.all(
|
|
67
|
-
(publishInfo.publishedPackages || []).map(
|
|
68
|
-
(pkg) => gitTag(`${pkg.name}@${pkg.version}`, appDir)
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
yield fs.remove(pnpmPublishSummaryFile);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
release
|
|
76
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
22
|
-
function status(options) {
|
|
23
|
-
return __async(this, null, function* () {
|
|
24
|
-
const params = [CHANGESET_PATH, "status"];
|
|
25
|
-
const { verbose, output, since } = options;
|
|
26
|
-
if (verbose) {
|
|
27
|
-
params.push("--verbose");
|
|
28
|
-
}
|
|
29
|
-
if (output) {
|
|
30
|
-
params.push("--output");
|
|
31
|
-
params.push(output);
|
|
32
|
-
}
|
|
33
|
-
if (since) {
|
|
34
|
-
params.push("--since");
|
|
35
|
-
params.push(since);
|
|
36
|
-
}
|
|
37
|
-
yield execaWithStreamLog(process.execPath, params);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
status
|
|
42
|
-
};
|
package/dist/js/modern/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { change, bump, pre, release, status, genReleaseNote } from "./commands";
|
|
2
|
-
import { i18n, localeKeys } from "./locale";
|
|
3
|
-
import { getLocaleLanguage } from "./utils";
|
|
4
|
-
export * from "./commands";
|
|
5
|
-
var src_default = () => ({
|
|
6
|
-
name: "@modern-js/plugin-changeset",
|
|
7
|
-
setup: () => {
|
|
8
|
-
i18n.changeLanguage({ locale: getLocaleLanguage() });
|
|
9
|
-
return {
|
|
10
|
-
commands({ program }) {
|
|
11
|
-
program.command("change").description(i18n.t(localeKeys.command.change.describe)).option("--empty", i18n.t(localeKeys.command.change.empty), false).option("--open", i18n.t(localeKeys.command.change.open), false).action((options) => change(options));
|
|
12
|
-
program.command("bump").description(i18n.t(localeKeys.command.bump.describe)).option("--canary", i18n.t(localeKeys.command.bump.canary), false).option(
|
|
13
|
-
"--ignore <package>",
|
|
14
|
-
i18n.t(localeKeys.command.bump.ignore),
|
|
15
|
-
(val, memo) => {
|
|
16
|
-
memo.push(val);
|
|
17
|
-
return memo;
|
|
18
|
-
},
|
|
19
|
-
[]
|
|
20
|
-
).option(
|
|
21
|
-
"--preid <tag>",
|
|
22
|
-
i18n.t(localeKeys.command.bump.preid),
|
|
23
|
-
"next"
|
|
24
|
-
).option(
|
|
25
|
-
"--snapshot [snapshot]",
|
|
26
|
-
i18n.t(localeKeys.command.bump.snapshot),
|
|
27
|
-
false
|
|
28
|
-
).action((options) => bump(options));
|
|
29
|
-
program.command("pre <enter|exit> [tag]").description(i18n.t(localeKeys.command.pre.describe)).action((type, tag) => pre(type, tag));
|
|
30
|
-
program.command("release").description(i18n.t(localeKeys.command.release.describe)).option("--tag <tag>", i18n.t(localeKeys.command.release.tag), "").option("--otp <token>", i18n.t(localeKeys.command.release.otp), "").option(
|
|
31
|
-
"--ignore-scripts",
|
|
32
|
-
i18n.t(localeKeys.command.release.ignore_scripts),
|
|
33
|
-
""
|
|
34
|
-
).option(
|
|
35
|
-
"--no-git-checks",
|
|
36
|
-
i18n.t(localeKeys.command.release.no_git_checks),
|
|
37
|
-
""
|
|
38
|
-
).action((options) => release(options));
|
|
39
|
-
program.command("change-status").description(i18n.t(localeKeys.command.status.describe)).option("--verbose", i18n.t(localeKeys.command.status.verbose)).option("--output <file>", i18n.t(localeKeys.command.status.output)).option("--since <ref>", i18n.t(localeKeys.command.status.since)).action((options) => status(options));
|
|
40
|
-
program.command("gen-release-note").description(i18n.t(localeKeys.command.gen_release_note.describe)).option(
|
|
41
|
-
"--repo <repo>",
|
|
42
|
-
i18n.t(localeKeys.command.gen_release_note.repo)
|
|
43
|
-
).option(
|
|
44
|
-
"--custom <cumtom>",
|
|
45
|
-
i18n.t(localeKeys.command.gen_release_note.custom)
|
|
46
|
-
).action((options) => genReleaseNote(options));
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
export {
|
|
52
|
-
src_default as default
|
|
53
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const EN_LOCALE = {
|
|
2
|
-
command: {
|
|
3
|
-
change: {
|
|
4
|
-
describe: "create changeset",
|
|
5
|
-
empty: "create an empty changeset",
|
|
6
|
-
open: "opens the created changeset in an external editor",
|
|
7
|
-
no_packages: "not find sub-project,please use `{packageManager} new` to create sub-project"
|
|
8
|
-
},
|
|
9
|
-
bump: {
|
|
10
|
-
describe: "auto update publish version and changelog using changeset",
|
|
11
|
-
canary: "create a prerelease version of publishing for testing",
|
|
12
|
-
preid: "specify the identifier when versioning a prerelease",
|
|
13
|
-
snapshot: "create a snapshot version of publishing for testing",
|
|
14
|
-
ignore: "skip packages from being published"
|
|
15
|
-
},
|
|
16
|
-
pre: {
|
|
17
|
-
describe: "enters and exits pre mode"
|
|
18
|
-
},
|
|
19
|
-
release: {
|
|
20
|
-
describe: "publish changes to npm",
|
|
21
|
-
tag: "publish use special tag",
|
|
22
|
-
otp: "publish package use one-time password, if you have auth and writes enabled on npm ",
|
|
23
|
-
ignore_scripts: "publish command ignore npm scripts, only can use in pnpm monorepo",
|
|
24
|
-
no_git_checks: "publish command ignore checking if current branch is your publish branch, clean, and up-to-date, only can use in pnpm monorepo"
|
|
25
|
-
},
|
|
26
|
-
status: {
|
|
27
|
-
describe: "provides information about the changesets that currently exist",
|
|
28
|
-
verbose: "provides detail information about the changesets that currently exist with table",
|
|
29
|
-
output: "write the information about the changesets that currently exist to json file",
|
|
30
|
-
since: "only display information about changesets since a specific branch or git tag"
|
|
31
|
-
},
|
|
32
|
-
gen_release_note: {
|
|
33
|
-
describe: "generator release note info from changesets",
|
|
34
|
-
repo: "reponame to generator pull request link, like modern-js-dev/modern.js",
|
|
35
|
-
custom: "custom release note render rules"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
EN_LOCALE
|
|
41
|
-
};
|