@modern-js/plugin-changeset 2.0.0-beta.0 → 2.0.0-beta.2
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 +46 -0
- package/dist/js/modern/commands/bump.js +0 -5
- package/dist/js/modern/commands/change.js +0 -6
- package/dist/js/modern/commands/pre.js +0 -2
- package/dist/js/modern/commands/release-note.js +2 -29
- package/dist/js/modern/commands/release.js +0 -9
- package/dist/js/modern/commands/status.js +0 -4
- package/dist/js/modern/index.js +0 -5
- package/dist/js/node/commands/bump.js +0 -7
- package/dist/js/node/commands/change.js +0 -12
- package/dist/js/node/commands/index.js +0 -12
- package/dist/js/node/commands/pre.js +0 -4
- package/dist/js/node/commands/release-note.js +2 -36
- package/dist/js/node/commands/release.js +0 -17
- package/dist/js/node/commands/status.js +0 -6
- package/dist/js/node/index.js +0 -12
- package/dist/js/node/locale/index.js +0 -4
- package/dist/js/node/utils/changeset.js +0 -4
- package/dist/js/node/utils/index.js +0 -4
- package/dist/js/node/utils/language.js +0 -2
- package/dist/types/index.d.ts +0 -2
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @modern-js/plugin-changeset
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9c3e: chore: v2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [92f0ead]
|
|
12
|
+
- Updated dependencies [edd1cfb1af]
|
|
13
|
+
- Updated dependencies [cc971eabfc]
|
|
14
|
+
- Updated dependencies [5b9049f2e9]
|
|
15
|
+
- Updated dependencies [92004d1]
|
|
16
|
+
- Updated dependencies [b8bbe036c7]
|
|
17
|
+
- Updated dependencies [d5a31df781]
|
|
18
|
+
- Updated dependencies [dda38c9c3e]
|
|
19
|
+
- Updated dependencies [3bbea92b2a]
|
|
20
|
+
- Updated dependencies [abf3421a75]
|
|
21
|
+
- Updated dependencies [543be9558e]
|
|
22
|
+
- Updated dependencies [14b712da84]
|
|
23
|
+
- @modern-js/utils@2.0.0-beta.2
|
|
24
|
+
- @modern-js/plugin-i18n@2.0.0-beta.2
|
|
25
|
+
|
|
26
|
+
## 2.0.0-beta.1
|
|
27
|
+
|
|
28
|
+
### Major Changes
|
|
29
|
+
|
|
30
|
+
- dda38c9: chore: v2
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [92f0ead]
|
|
35
|
+
- Updated dependencies [edd1cfb1af]
|
|
36
|
+
- Updated dependencies [cc971eabfc]
|
|
37
|
+
- Updated dependencies [5b9049f]
|
|
38
|
+
- Updated dependencies [92004d1]
|
|
39
|
+
- Updated dependencies [b8bbe036c7]
|
|
40
|
+
- Updated dependencies [d5a31df781]
|
|
41
|
+
- Updated dependencies [dda38c9]
|
|
42
|
+
- Updated dependencies [3bbea92b2a]
|
|
43
|
+
- Updated dependencies [abf3421]
|
|
44
|
+
- Updated dependencies [543be9558e]
|
|
45
|
+
- Updated dependencies [14b712d]
|
|
46
|
+
- @modern-js/utils@2.0.0-beta.1
|
|
47
|
+
- @modern-js/plugin-i18n@2.0.0-beta.1
|
|
48
|
+
|
|
3
49
|
## 2.0.0-beta.0
|
|
4
50
|
|
|
5
51
|
### Major Changes
|
|
@@ -7,25 +7,20 @@ export async function bump(options) {
|
|
|
7
7
|
ignore
|
|
8
8
|
} = options;
|
|
9
9
|
const params = [CHANGESET_PATH, 'version'];
|
|
10
|
-
|
|
11
10
|
if (snapshot) {
|
|
12
11
|
params.push('--snapshot');
|
|
13
|
-
|
|
14
12
|
if (typeof snapshot === 'string') {
|
|
15
13
|
params.push(snapshot);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
if (ignore) {
|
|
20
17
|
ignore.forEach(pkg => {
|
|
21
18
|
params.push('--ignore');
|
|
22
19
|
params.push(pkg);
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
if (canary) {
|
|
27
23
|
await execaWithStreamLog(process.execPath, [CHANGESET_PATH, 'pre', 'enter', preid || 'next']);
|
|
28
|
-
|
|
29
24
|
try {
|
|
30
25
|
await execaWithStreamLog(process.execPath, params);
|
|
31
26
|
await execaWithStreamLog(process.execPath, [CHANGESET_PATH, 'pre', 'exit']);
|
|
@@ -3,10 +3,8 @@ import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
|
3
3
|
import { i18n, localeKeys } from "../locale";
|
|
4
4
|
export async function change(options) {
|
|
5
5
|
const appDir = process.cwd();
|
|
6
|
-
|
|
7
6
|
if (isMonorepo(appDir)) {
|
|
8
7
|
const packages = getMonorepoPackages(appDir);
|
|
9
|
-
|
|
10
8
|
if (packages.length === 0) {
|
|
11
9
|
const packageManager = await getPackageManager(appDir);
|
|
12
10
|
logger.warn(i18n.t(localeKeys.command.change.no_packages, {
|
|
@@ -15,20 +13,16 @@ export async function change(options) {
|
|
|
15
13
|
return;
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
const {
|
|
20
17
|
empty,
|
|
21
18
|
open
|
|
22
19
|
} = options;
|
|
23
20
|
const params = [CHANGESET_PATH, 'add'];
|
|
24
|
-
|
|
25
21
|
if (empty) {
|
|
26
22
|
params.push('--empty');
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
if (open) {
|
|
30
25
|
params.push('--open');
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
await execaWithStreamLog(process.execPath, params);
|
|
34
28
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
|
|
2
2
|
export async function pre(type, tag = 'next') {
|
|
3
3
|
const params = [CHANGESET_PATH, 'pre', type];
|
|
4
|
-
|
|
5
4
|
if (type === 'enter') {
|
|
6
5
|
params.push(tag);
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
await execaWithStreamLog(process.execPath, params);
|
|
10
8
|
}
|
|
@@ -6,52 +6,41 @@ export function getReleaseInfo(commit, commitObj) {
|
|
|
6
6
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
7
7
|
const [, message, author] = commit.split('--');
|
|
8
8
|
commitObj.author = author;
|
|
9
|
-
|
|
10
9
|
if ((message || commitObj.summary).match(commitRegex)) {
|
|
11
10
|
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
12
11
|
commitObj.pullRequestId = pullRequestId;
|
|
13
12
|
commitObj.message = messageShort.trim();
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
return commitObj;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
function formatSummary(summary, pullRequestId) {
|
|
20
17
|
const [firstLine, ...futureLines] = summary.split('\n').map(l => l.trimRight());
|
|
21
18
|
let returnVal = firstLine;
|
|
22
|
-
|
|
23
19
|
if (futureLines.length > 0) {
|
|
24
20
|
if (pullRequestId) {
|
|
25
21
|
returnVal = `\n\n ${returnVal}`;
|
|
26
22
|
} else {
|
|
27
23
|
returnVal = `\n ${returnVal}`;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
returnVal += `\n\n ${futureLines.filter(l => Boolean(l)).map(l => l).join('\n\n')}`;
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
return returnVal;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
export function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
37
30
|
if (customReleaseNoteFunction !== null && customReleaseNoteFunction !== void 0 && customReleaseNoteFunction.getReleaseNoteLine) {
|
|
38
31
|
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
const {
|
|
42
34
|
repository,
|
|
43
35
|
pullRequestId,
|
|
44
36
|
summary
|
|
45
37
|
} = commit;
|
|
46
|
-
|
|
47
38
|
if (pullRequestId && repository) {
|
|
48
39
|
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(summary, pullRequestId)}\n`;
|
|
49
40
|
}
|
|
50
|
-
|
|
51
41
|
if (pullRequestId) {
|
|
52
42
|
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}\n`;
|
|
53
43
|
}
|
|
54
|
-
|
|
55
44
|
return `${formatSummary(summary, pullRequestId)}\n`;
|
|
56
45
|
}
|
|
57
46
|
export async function genReleaseNote(options) {
|
|
@@ -62,44 +51,35 @@ export async function genReleaseNote(options) {
|
|
|
62
51
|
} = options;
|
|
63
52
|
let repository = repo;
|
|
64
53
|
let customReleaseNoteFunction;
|
|
65
|
-
|
|
66
54
|
if (!repo) {
|
|
67
55
|
const pkg = await fs.readJSON(path.join(cwd, 'package.json'));
|
|
68
56
|
({
|
|
69
57
|
repository
|
|
70
58
|
} = pkg);
|
|
71
59
|
}
|
|
72
|
-
|
|
73
60
|
if (custom) {
|
|
74
61
|
let possibleReleaseNoteFunc;
|
|
75
62
|
const releasenotePath = resolveFrom(cwd, custom);
|
|
76
63
|
possibleReleaseNoteFunc = require(releasenotePath);
|
|
77
|
-
|
|
78
64
|
if (possibleReleaseNoteFunc.default) {
|
|
79
65
|
possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
|
|
80
66
|
}
|
|
81
|
-
|
|
82
67
|
if (typeof possibleReleaseNoteFunc.getReleaseInfo === 'function' && typeof possibleReleaseNoteFunc.getReleaseNoteLine === 'function') {
|
|
83
68
|
customReleaseNoteFunction = possibleReleaseNoteFunc;
|
|
84
69
|
} else {
|
|
85
70
|
throw new Error('Could not resolve relesae note generation functions');
|
|
86
71
|
}
|
|
87
72
|
}
|
|
88
|
-
|
|
89
73
|
const changesets = await readChangesets(cwd);
|
|
90
|
-
|
|
91
74
|
if (changesets.length === 0) {
|
|
92
|
-
console.warn('No unreleased changesets found.');
|
|
93
|
-
|
|
75
|
+
console.warn('No unreleased changesets found.');
|
|
76
|
+
// eslint-disable-next-line no-process-exit
|
|
94
77
|
process.exit(1);
|
|
95
78
|
}
|
|
96
|
-
|
|
97
79
|
const features = [];
|
|
98
80
|
const bugFix = [];
|
|
99
|
-
|
|
100
81
|
for (const changeset of changesets) {
|
|
101
82
|
var _customReleaseNoteFun;
|
|
102
|
-
|
|
103
83
|
const {
|
|
104
84
|
stdout
|
|
105
85
|
} = await execa('git', ['log', '--pretty=format:%h--%s--%an', `.changeset/${changeset.id}.md`]);
|
|
@@ -111,36 +91,29 @@ export async function genReleaseNote(options) {
|
|
|
111
91
|
message: (message || changeset.summary).trim(),
|
|
112
92
|
summary: changeset.summary
|
|
113
93
|
};
|
|
114
|
-
|
|
115
94
|
if ((_customReleaseNoteFun = customReleaseNoteFunction) !== null && _customReleaseNoteFun !== void 0 && _customReleaseNoteFun.getReleaseInfo) {
|
|
116
95
|
commitObj = await customReleaseNoteFunction.getReleaseInfo(stdout, commitObj);
|
|
117
96
|
} else {
|
|
118
97
|
commitObj = getReleaseInfo(stdout, commitObj);
|
|
119
98
|
}
|
|
120
|
-
|
|
121
99
|
if (commitObj.type === 'fix') {
|
|
122
100
|
bugFix.push(commitObj);
|
|
123
101
|
} else {
|
|
124
102
|
features.push(commitObj);
|
|
125
103
|
}
|
|
126
104
|
}
|
|
127
|
-
|
|
128
105
|
if (!features.length && !bugFix.length) {
|
|
129
106
|
console.warn('no release note found, you can run `pnpm run add` to add changeset');
|
|
130
107
|
}
|
|
131
|
-
|
|
132
108
|
if (features.length) {
|
|
133
109
|
console.info('## Features:\n');
|
|
134
|
-
|
|
135
110
|
for (const commit of features) {
|
|
136
111
|
const releaseNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
|
|
137
112
|
console.info(releaseNote);
|
|
138
113
|
}
|
|
139
114
|
}
|
|
140
|
-
|
|
141
115
|
if (bugFix.length) {
|
|
142
116
|
console.info('## Bug Fix:\n');
|
|
143
|
-
|
|
144
117
|
for (const commit of bugFix) {
|
|
145
118
|
const relesaeNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
|
|
146
119
|
console.info(relesaeNote);
|
|
@@ -12,42 +12,33 @@ export async function release(options) {
|
|
|
12
12
|
ignoreScripts,
|
|
13
13
|
gitChecks
|
|
14
14
|
} = options;
|
|
15
|
-
|
|
16
15
|
if (tag) {
|
|
17
16
|
params.push('--tag');
|
|
18
17
|
params.push(tag);
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
if (otp) {
|
|
22
20
|
params.push('--otp');
|
|
23
21
|
params.push(otp);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
if (!isMonorepo(appDir) || packageManager === 'yarn' || packageManager === 'npm') {
|
|
27
24
|
await execaWithStreamLog(process.execPath, [CHANGESET_PATH, ...params]);
|
|
28
25
|
return;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
params.push('-r');
|
|
32
28
|
params.push('--filter');
|
|
33
29
|
const pnpmVersion = await getPnpmVersion();
|
|
34
|
-
|
|
35
30
|
if (pnpmVersion.startsWith('6')) {
|
|
36
31
|
params.push('./packages/');
|
|
37
32
|
} else {
|
|
38
33
|
params.push('{./packages/**}');
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
params.push('--report-summary');
|
|
42
|
-
|
|
43
36
|
if (ignoreScripts) {
|
|
44
37
|
params.push('--ignore-scripts');
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
if (!gitChecks) {
|
|
48
40
|
params.push('--no-git-checks');
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
await execaWithStreamLog(packageManager, params);
|
|
52
43
|
const pnpmPublishSummaryFile = path.join(appDir, 'pnpm-publish-summary.json');
|
|
53
44
|
const publishInfo = await fs.readJSON(pnpmPublishSummaryFile, 'utf-8');
|
|
@@ -6,20 +6,16 @@ export async function status(options) {
|
|
|
6
6
|
output,
|
|
7
7
|
since
|
|
8
8
|
} = options;
|
|
9
|
-
|
|
10
9
|
if (verbose) {
|
|
11
10
|
params.push('--verbose');
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
if (output) {
|
|
15
13
|
params.push('--output');
|
|
16
14
|
params.push(output);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
if (since) {
|
|
20
17
|
params.push('--since');
|
|
21
18
|
params.push(since);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
await execaWithStreamLog(process.execPath, params);
|
|
25
21
|
}
|
package/dist/js/modern/index.js
CHANGED
|
@@ -10,10 +10,6 @@ export default (() => ({
|
|
|
10
10
|
locale: getLocaleLanguage()
|
|
11
11
|
});
|
|
12
12
|
return {
|
|
13
|
-
plugins() {
|
|
14
|
-
return [{}];
|
|
15
|
-
},
|
|
16
|
-
|
|
17
13
|
commands({
|
|
18
14
|
program
|
|
19
15
|
}) {
|
|
@@ -27,7 +23,6 @@ export default (() => ({
|
|
|
27
23
|
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));
|
|
28
24
|
program.command('gen-release-note').description(i18n.t(localeKeys.command.gen_release_note.describe)).option('--repo <repo>', i18n.t(localeKeys.command.gen_release_note.repo)).option('--custom <cumtom>', i18n.t(localeKeys.command.gen_release_note.custom)).action(options => genReleaseNote(options));
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
};
|
|
32
27
|
}
|
|
33
28
|
}));
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.bump = bump;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
8
|
async function bump(options) {
|
|
11
9
|
const {
|
|
12
10
|
snapshot,
|
|
@@ -15,25 +13,20 @@ async function bump(options) {
|
|
|
15
13
|
ignore
|
|
16
14
|
} = options;
|
|
17
15
|
const params = [_utils.CHANGESET_PATH, 'version'];
|
|
18
|
-
|
|
19
16
|
if (snapshot) {
|
|
20
17
|
params.push('--snapshot');
|
|
21
|
-
|
|
22
18
|
if (typeof snapshot === 'string') {
|
|
23
19
|
params.push(snapshot);
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
if (ignore) {
|
|
28
23
|
ignore.forEach(pkg => {
|
|
29
24
|
params.push('--ignore');
|
|
30
25
|
params.push(pkg);
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
if (canary) {
|
|
35
29
|
await (0, _utils.execaWithStreamLog)(process.execPath, [_utils.CHANGESET_PATH, 'pre', 'enter', preid || 'next']);
|
|
36
|
-
|
|
37
30
|
try {
|
|
38
31
|
await (0, _utils.execaWithStreamLog)(process.execPath, params);
|
|
39
32
|
await (0, _utils.execaWithStreamLog)(process.execPath, [_utils.CHANGESET_PATH, 'pre', 'exit']);
|
|
@@ -4,43 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.change = change;
|
|
7
|
-
|
|
8
7
|
var _utils = require("@modern-js/utils");
|
|
9
|
-
|
|
10
8
|
var _utils2 = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _locale = require("../locale");
|
|
13
|
-
|
|
14
10
|
async function change(options) {
|
|
15
11
|
const appDir = process.cwd();
|
|
16
|
-
|
|
17
12
|
if ((0, _utils.isMonorepo)(appDir)) {
|
|
18
13
|
const packages = (0, _utils.getMonorepoPackages)(appDir);
|
|
19
|
-
|
|
20
14
|
if (packages.length === 0) {
|
|
21
15
|
const packageManager = await (0, _utils.getPackageManager)(appDir);
|
|
22
|
-
|
|
23
16
|
_utils.logger.warn(_locale.i18n.t(_locale.localeKeys.command.change.no_packages, {
|
|
24
17
|
packageManager: packageManager === 'yarn' ? 'yarn' : `${packageManager} run`
|
|
25
18
|
}));
|
|
26
|
-
|
|
27
19
|
return;
|
|
28
20
|
}
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
const {
|
|
32
23
|
empty,
|
|
33
24
|
open
|
|
34
25
|
} = options;
|
|
35
26
|
const params = [_utils2.CHANGESET_PATH, 'add'];
|
|
36
|
-
|
|
37
27
|
if (empty) {
|
|
38
28
|
params.push('--empty');
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
if (open) {
|
|
42
31
|
params.push('--open');
|
|
43
32
|
}
|
|
44
|
-
|
|
45
33
|
await (0, _utils2.execaWithStreamLog)(process.execPath, params);
|
|
46
34
|
}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _change = require("./change");
|
|
8
|
-
|
|
9
7
|
Object.keys(_change).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _change[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_change).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _bump = require("./bump");
|
|
21
|
-
|
|
22
18
|
Object.keys(_bump).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _bump[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_bump).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _pre = require("./pre");
|
|
34
|
-
|
|
35
29
|
Object.keys(_pre).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _pre[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_pre).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _release = require("./release");
|
|
47
|
-
|
|
48
40
|
Object.keys(_release).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _release[key]) return;
|
|
@@ -55,9 +47,7 @@ Object.keys(_release).forEach(function (key) {
|
|
|
55
47
|
}
|
|
56
48
|
});
|
|
57
49
|
});
|
|
58
|
-
|
|
59
50
|
var _status = require("./status");
|
|
60
|
-
|
|
61
51
|
Object.keys(_status).forEach(function (key) {
|
|
62
52
|
if (key === "default" || key === "__esModule") return;
|
|
63
53
|
if (key in exports && exports[key] === _status[key]) return;
|
|
@@ -68,9 +58,7 @@ Object.keys(_status).forEach(function (key) {
|
|
|
68
58
|
}
|
|
69
59
|
});
|
|
70
60
|
});
|
|
71
|
-
|
|
72
61
|
var _releaseNote = require("./release-note");
|
|
73
|
-
|
|
74
62
|
Object.keys(_releaseNote).forEach(function (key) {
|
|
75
63
|
if (key === "default" || key === "__esModule") return;
|
|
76
64
|
if (key in exports && exports[key] === _releaseNote[key]) return;
|
|
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.pre = pre;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
8
|
async function pre(type, tag = 'next') {
|
|
11
9
|
const params = [_utils.CHANGESET_PATH, 'pre', type];
|
|
12
|
-
|
|
13
10
|
if (type === 'enter') {
|
|
14
11
|
params.push(tag);
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
await (0, _utils.execaWithStreamLog)(process.execPath, params);
|
|
18
14
|
}
|
|
@@ -6,70 +6,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.genReleaseNote = genReleaseNote;
|
|
7
7
|
exports.getReleaseInfo = getReleaseInfo;
|
|
8
8
|
exports.getReleaseNoteLine = getReleaseNoteLine;
|
|
9
|
-
|
|
10
9
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
10
|
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
13
|
-
|
|
14
11
|
var _utils = require("@modern-js/utils");
|
|
15
|
-
|
|
16
12
|
var _read = _interopRequireDefault(require("@changesets/read"));
|
|
17
|
-
|
|
18
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
14
|
function getReleaseInfo(commit, commitObj) {
|
|
21
15
|
const commitRegex = /(.*)\(#(\d*)\)/;
|
|
22
16
|
const [, message, author] = commit.split('--');
|
|
23
17
|
commitObj.author = author;
|
|
24
|
-
|
|
25
18
|
if ((message || commitObj.summary).match(commitRegex)) {
|
|
26
19
|
const [, messageShort, pullRequestId] = (message || commitObj.summary).match(commitRegex);
|
|
27
20
|
commitObj.pullRequestId = pullRequestId;
|
|
28
21
|
commitObj.message = messageShort.trim();
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
return commitObj;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
function formatSummary(summary, pullRequestId) {
|
|
35
26
|
const [firstLine, ...futureLines] = summary.split('\n').map(l => l.trimRight());
|
|
36
27
|
let returnVal = firstLine;
|
|
37
|
-
|
|
38
28
|
if (futureLines.length > 0) {
|
|
39
29
|
if (pullRequestId) {
|
|
40
30
|
returnVal = `\n\n ${returnVal}`;
|
|
41
31
|
} else {
|
|
42
32
|
returnVal = `\n ${returnVal}`;
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
returnVal += `\n\n ${futureLines.filter(l => Boolean(l)).map(l => l).join('\n\n')}`;
|
|
46
35
|
}
|
|
47
|
-
|
|
48
36
|
return returnVal;
|
|
49
37
|
}
|
|
50
|
-
|
|
51
38
|
function getReleaseNoteLine(commit, customReleaseNoteFunction) {
|
|
52
39
|
if (customReleaseNoteFunction !== null && customReleaseNoteFunction !== void 0 && customReleaseNoteFunction.getReleaseNoteLine) {
|
|
53
40
|
return customReleaseNoteFunction.getReleaseNoteLine(commit);
|
|
54
41
|
}
|
|
55
|
-
|
|
56
42
|
const {
|
|
57
43
|
repository,
|
|
58
44
|
pullRequestId,
|
|
59
45
|
summary
|
|
60
46
|
} = commit;
|
|
61
|
-
|
|
62
47
|
if (pullRequestId && repository) {
|
|
63
48
|
return `- [#${pullRequestId}](https://github.com/${repository}/pull/${pullRequestId}) ${formatSummary(summary, pullRequestId)}\n`;
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
if (pullRequestId) {
|
|
67
51
|
return `#${pullRequestId} ${formatSummary(summary, pullRequestId)}\n`;
|
|
68
52
|
}
|
|
69
|
-
|
|
70
53
|
return `${formatSummary(summary, pullRequestId)}\n`;
|
|
71
54
|
}
|
|
72
|
-
|
|
73
55
|
async function genReleaseNote(options) {
|
|
74
56
|
const cwd = process.cwd();
|
|
75
57
|
const {
|
|
@@ -78,44 +60,35 @@ async function genReleaseNote(options) {
|
|
|
78
60
|
} = options;
|
|
79
61
|
let repository = repo;
|
|
80
62
|
let customReleaseNoteFunction;
|
|
81
|
-
|
|
82
63
|
if (!repo) {
|
|
83
64
|
const pkg = await _utils.fs.readJSON(_path.default.join(cwd, 'package.json'));
|
|
84
65
|
({
|
|
85
66
|
repository
|
|
86
67
|
} = pkg);
|
|
87
68
|
}
|
|
88
|
-
|
|
89
69
|
if (custom) {
|
|
90
70
|
let possibleReleaseNoteFunc;
|
|
91
71
|
const releasenotePath = (0, _resolveFrom.default)(cwd, custom);
|
|
92
72
|
possibleReleaseNoteFunc = require(releasenotePath);
|
|
93
|
-
|
|
94
73
|
if (possibleReleaseNoteFunc.default) {
|
|
95
74
|
possibleReleaseNoteFunc = possibleReleaseNoteFunc.default;
|
|
96
75
|
}
|
|
97
|
-
|
|
98
76
|
if (typeof possibleReleaseNoteFunc.getReleaseInfo === 'function' && typeof possibleReleaseNoteFunc.getReleaseNoteLine === 'function') {
|
|
99
77
|
customReleaseNoteFunction = possibleReleaseNoteFunc;
|
|
100
78
|
} else {
|
|
101
79
|
throw new Error('Could not resolve relesae note generation functions');
|
|
102
80
|
}
|
|
103
81
|
}
|
|
104
|
-
|
|
105
82
|
const changesets = await (0, _read.default)(cwd);
|
|
106
|
-
|
|
107
83
|
if (changesets.length === 0) {
|
|
108
|
-
console.warn('No unreleased changesets found.');
|
|
109
|
-
|
|
84
|
+
console.warn('No unreleased changesets found.');
|
|
85
|
+
// eslint-disable-next-line no-process-exit
|
|
110
86
|
process.exit(1);
|
|
111
87
|
}
|
|
112
|
-
|
|
113
88
|
const features = [];
|
|
114
89
|
const bugFix = [];
|
|
115
|
-
|
|
116
90
|
for (const changeset of changesets) {
|
|
117
91
|
var _customReleaseNoteFun;
|
|
118
|
-
|
|
119
92
|
const {
|
|
120
93
|
stdout
|
|
121
94
|
} = await (0, _utils.execa)('git', ['log', '--pretty=format:%h--%s--%an', `.changeset/${changeset.id}.md`]);
|
|
@@ -127,36 +100,29 @@ async function genReleaseNote(options) {
|
|
|
127
100
|
message: (message || changeset.summary).trim(),
|
|
128
101
|
summary: changeset.summary
|
|
129
102
|
};
|
|
130
|
-
|
|
131
103
|
if ((_customReleaseNoteFun = customReleaseNoteFunction) !== null && _customReleaseNoteFun !== void 0 && _customReleaseNoteFun.getReleaseInfo) {
|
|
132
104
|
commitObj = await customReleaseNoteFunction.getReleaseInfo(stdout, commitObj);
|
|
133
105
|
} else {
|
|
134
106
|
commitObj = getReleaseInfo(stdout, commitObj);
|
|
135
107
|
}
|
|
136
|
-
|
|
137
108
|
if (commitObj.type === 'fix') {
|
|
138
109
|
bugFix.push(commitObj);
|
|
139
110
|
} else {
|
|
140
111
|
features.push(commitObj);
|
|
141
112
|
}
|
|
142
113
|
}
|
|
143
|
-
|
|
144
114
|
if (!features.length && !bugFix.length) {
|
|
145
115
|
console.warn('no release note found, you can run `pnpm run add` to add changeset');
|
|
146
116
|
}
|
|
147
|
-
|
|
148
117
|
if (features.length) {
|
|
149
118
|
console.info('## Features:\n');
|
|
150
|
-
|
|
151
119
|
for (const commit of features) {
|
|
152
120
|
const releaseNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
|
|
153
121
|
console.info(releaseNote);
|
|
154
122
|
}
|
|
155
123
|
}
|
|
156
|
-
|
|
157
124
|
if (bugFix.length) {
|
|
158
125
|
console.info('## Bug Fix:\n');
|
|
159
|
-
|
|
160
126
|
for (const commit of bugFix) {
|
|
161
127
|
const relesaeNote = await getReleaseNoteLine(commit, customReleaseNoteFunction);
|
|
162
128
|
console.info(relesaeNote);
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.release = release;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
9
|
var _git = require("@changesets/git");
|
|
13
|
-
|
|
14
10
|
var _utils2 = require("../utils");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
async function release(options) {
|
|
19
13
|
const appDir = process.cwd();
|
|
20
14
|
const packageManager = await (0, _utils.getPackageManager)(process.cwd());
|
|
@@ -25,46 +19,35 @@ async function release(options) {
|
|
|
25
19
|
ignoreScripts,
|
|
26
20
|
gitChecks
|
|
27
21
|
} = options;
|
|
28
|
-
|
|
29
22
|
if (tag) {
|
|
30
23
|
params.push('--tag');
|
|
31
24
|
params.push(tag);
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
if (otp) {
|
|
35
27
|
params.push('--otp');
|
|
36
28
|
params.push(otp);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
if (!(0, _utils.isMonorepo)(appDir) || packageManager === 'yarn' || packageManager === 'npm') {
|
|
40
31
|
await (0, _utils2.execaWithStreamLog)(process.execPath, [_utils2.CHANGESET_PATH, ...params]);
|
|
41
32
|
return;
|
|
42
33
|
}
|
|
43
|
-
|
|
44
34
|
params.push('-r');
|
|
45
35
|
params.push('--filter');
|
|
46
36
|
const pnpmVersion = await (0, _utils.getPnpmVersion)();
|
|
47
|
-
|
|
48
37
|
if (pnpmVersion.startsWith('6')) {
|
|
49
38
|
params.push('./packages/');
|
|
50
39
|
} else {
|
|
51
40
|
params.push('{./packages/**}');
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
params.push('--report-summary');
|
|
55
|
-
|
|
56
43
|
if (ignoreScripts) {
|
|
57
44
|
params.push('--ignore-scripts');
|
|
58
45
|
}
|
|
59
|
-
|
|
60
46
|
if (!gitChecks) {
|
|
61
47
|
params.push('--no-git-checks');
|
|
62
48
|
}
|
|
63
|
-
|
|
64
49
|
await (0, _utils2.execaWithStreamLog)(packageManager, params);
|
|
65
|
-
|
|
66
50
|
const pnpmPublishSummaryFile = _path.default.join(appDir, 'pnpm-publish-summary.json');
|
|
67
|
-
|
|
68
51
|
const publishInfo = await _utils.fs.readJSON(pnpmPublishSummaryFile, 'utf-8');
|
|
69
52
|
await Promise.all((publishInfo.publishedPackages || []).map(pkg => (0, _git.tag)(`${pkg.name}@${pkg.version}`, appDir)));
|
|
70
53
|
await _utils.fs.remove(pnpmPublishSummaryFile);
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.status = status;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
8
|
async function status(options) {
|
|
11
9
|
const params = [_utils.CHANGESET_PATH, 'status'];
|
|
12
10
|
const {
|
|
@@ -14,20 +12,16 @@ async function status(options) {
|
|
|
14
12
|
output,
|
|
15
13
|
since
|
|
16
14
|
} = options;
|
|
17
|
-
|
|
18
15
|
if (verbose) {
|
|
19
16
|
params.push('--verbose');
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
if (output) {
|
|
23
19
|
params.push('--output');
|
|
24
20
|
params.push(output);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
if (since) {
|
|
28
23
|
params.push('--since');
|
|
29
24
|
params.push(since);
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
await (0, _utils.execaWithStreamLog)(process.execPath, params);
|
|
33
27
|
}
|
package/dist/js/node/index.js
CHANGED
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {};
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
|
|
9
8
|
var _commands = require("./commands");
|
|
10
|
-
|
|
11
9
|
Object.keys(_commands).forEach(function (key) {
|
|
12
10
|
if (key === "default" || key === "__esModule") return;
|
|
13
11
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -19,11 +17,8 @@ Object.keys(_commands).forEach(function (key) {
|
|
|
19
17
|
}
|
|
20
18
|
});
|
|
21
19
|
});
|
|
22
|
-
|
|
23
20
|
var _locale = require("./locale");
|
|
24
|
-
|
|
25
21
|
var _utils = require("./utils");
|
|
26
|
-
|
|
27
22
|
var _default = () => ({
|
|
28
23
|
name: '@modern-js/plugin-changeset',
|
|
29
24
|
setup: () => {
|
|
@@ -31,12 +26,7 @@ var _default = () => ({
|
|
|
31
26
|
_locale.i18n.changeLanguage({
|
|
32
27
|
locale: (0, _utils.getLocaleLanguage)()
|
|
33
28
|
});
|
|
34
|
-
|
|
35
29
|
return {
|
|
36
|
-
plugins() {
|
|
37
|
-
return [{}];
|
|
38
|
-
},
|
|
39
|
-
|
|
40
30
|
commands({
|
|
41
31
|
program
|
|
42
32
|
}) {
|
|
@@ -50,9 +40,7 @@ var _default = () => ({
|
|
|
50
40
|
program.command('change-status').description(_locale.i18n.t(_locale.localeKeys.command.status.describe)).option('--verbose', _locale.i18n.t(_locale.localeKeys.command.status.verbose)).option('--output <file>', _locale.i18n.t(_locale.localeKeys.command.status.output)).option('--since <ref>', _locale.i18n.t(_locale.localeKeys.command.status.since)).action(options => (0, _commands.status)(options));
|
|
51
41
|
program.command('gen-release-note').description(_locale.i18n.t(_locale.localeKeys.command.gen_release_note.describe)).option('--repo <repo>', _locale.i18n.t(_locale.localeKeys.command.gen_release_note.repo)).option('--custom <cumtom>', _locale.i18n.t(_locale.localeKeys.command.gen_release_note.custom)).action(options => (0, _commands.genReleaseNote)(options));
|
|
52
42
|
}
|
|
53
|
-
|
|
54
43
|
};
|
|
55
44
|
}
|
|
56
45
|
});
|
|
57
|
-
|
|
58
46
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.localeKeys = exports.i18n = void 0;
|
|
7
|
-
|
|
8
7
|
var _pluginI18n = require("@modern-js/plugin-i18n");
|
|
9
|
-
|
|
10
8
|
var _zh = require("./zh");
|
|
11
|
-
|
|
12
9
|
var _en = require("./en");
|
|
13
|
-
|
|
14
10
|
const i18n = new _pluginI18n.I18n();
|
|
15
11
|
exports.i18n = i18n;
|
|
16
12
|
const localeKeys = i18n.init('zh', {
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CHANGESET_PATH = void 0;
|
|
7
7
|
exports.execaWithStreamLog = execaWithStreamLog;
|
|
8
|
-
|
|
9
8
|
var _utils = require("@modern-js/utils");
|
|
10
|
-
|
|
11
9
|
const CHANGESET_PATH = require.resolve('@changesets/cli');
|
|
12
|
-
|
|
13
10
|
exports.CHANGESET_PATH = CHANGESET_PATH;
|
|
14
|
-
|
|
15
11
|
function execaWithStreamLog(command, args) {
|
|
16
12
|
const promise = (0, _utils.execa)(command, args, {
|
|
17
13
|
stdin: 'inherit',
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _changeset = require("./changeset");
|
|
8
|
-
|
|
9
7
|
Object.keys(_changeset).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _changeset[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_changeset).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _language = require("./language");
|
|
21
|
-
|
|
22
18
|
Object.keys(_language).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _language[key]) return;
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getLocaleLanguage = getLocaleLanguage;
|
|
7
|
-
|
|
8
7
|
var _languageDetector = require("@modern-js/plugin-i18n/language-detector");
|
|
9
|
-
|
|
10
8
|
function getLocaleLanguage() {
|
|
11
9
|
const detector = new _languageDetector.I18CLILanguageDetector();
|
|
12
10
|
return detector.detect();
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.2",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
"@changesets/cli": "^2.23.0",
|
|
36
36
|
"@changesets/git": "^1.3.2",
|
|
37
37
|
"@changesets/read": "^0.5.5",
|
|
38
|
-
"@modern-js/plugin-i18n": "2.0.0-beta.0",
|
|
39
|
-
"@modern-js/utils": "2.0.0-beta.0",
|
|
40
38
|
"execa": "^5.1.1",
|
|
41
|
-
"resolve-from": "^5.0.0"
|
|
39
|
+
"resolve-from": "^5.0.0",
|
|
40
|
+
"@modern-js/plugin-i18n": "2.0.0-beta.2",
|
|
41
|
+
"@modern-js/utils": "2.0.0-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@modern-js/core": "2.0.0-beta.0",
|
|
45
|
-
"@scripts/build": "2.0.0-beta.0",
|
|
46
44
|
"@types/jest": "^27",
|
|
47
45
|
"@types/node": "^14",
|
|
48
46
|
"typescript": "^4",
|
|
49
47
|
"jest": "^27",
|
|
50
|
-
"@
|
|
48
|
+
"@modern-js/core": "2.0.0-beta.2",
|
|
49
|
+
"@scripts/build": "2.0.0-beta.2",
|
|
50
|
+
"@scripts/jest-config": "2.0.0-beta.2"
|
|
51
51
|
},
|
|
52
52
|
"sideEffects": false,
|
|
53
53
|
"publishConfig": {
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"new": "modern new",
|
|
59
|
-
"dev": "modern build --watch",
|
|
60
|
-
"build": "modern build",
|
|
58
|
+
"new": "modern-lib new",
|
|
59
|
+
"dev": "modern-lib build --watch",
|
|
60
|
+
"build": "modern-lib build",
|
|
61
61
|
"test": "jest --passWithNoTests"
|
|
62
62
|
}
|
|
63
63
|
}
|