@samitouri / QOS-React-2 / commits / c9100d95b9

DevTools release script: Show changelog before minor/patch prompt (#24200)

Brian Vaughn committed Mar 30, 2022 at 09:26 UTC c9100d95b97913192397772ad81038ba322d068b
1 file changed +18 -8
scripts/devtools/prepare-release.js
+18 -8
@@ -31,6 +31,16 @@ async function main() {
31
32 await checkNPMPermissions();
33
34 + const sha = await getPreviousCommitSha();
35 + const [shortCommitLog, formattedCommitLog] = await getCommitLog(sha);
36 +
37 + console.log('');
38 + console.log(
39 + 'This release includes the following commits:',
40 + chalk.gray(shortCommitLog)
41 + );
42 + console.log('');
43 +
44 const releaseType = await getReleaseType();
45
46 const path = join(ROOT_PATH, PACKAGE_PATHS[0]);
@@ -41,6 +51,10 @@ async function main() {
51 ? `${major}.${minor + 1}.0`
52 : `${major}.${minor}.${patch + 1}`;
53
54 + updateChangelog(nextVersion, formattedCommitLog);
55 +
56 + await reviewChangelogPrompt();
57 +
58 updatePackageVersions(previousVersion, nextVersion);
59 updateManifestVersions(previousVersion, nextVersion);
60
@@ -52,13 +66,6 @@ async function main() {
66 );
67 console.log('');
68
55 - const sha = await getPreviousCommitSha();
56 - const commitLog = await getCommitLog(sha);
57 -
58 - updateChangelog(nextVersion, commitLog);
59 -
60 - await reviewChangelogPrompt();
61 -
69 await commitPendingChanges(previousVersion, nextVersion);
70
71 printFinalInstructions();
@@ -89,6 +96,7 @@ async function commitPendingChanges(previousVersion, nextVersion) {
96 }
97
98 async function getCommitLog(sha) {
99 + let shortLog = '';
100 let formattedLog = '';
101
102 const rawLog = await execRead(`
@@ -103,12 +111,14 @@ async function getCommitLog(sha) {
111 const pr = match[2];
112
113 formattedLog += `\n* ${title} ([USERNAME](https://github.com/USERNAME) in [#${pr}](${PULL_REQUEST_BASE_URL}${pr}))`;
114 + shortLog += `\n* ${title}`;
115 } else {
116 formattedLog += `\n* ${line}`;
117 + shortLog += `\n* ${line}`;
118 }
119 });
120
111 - return formattedLog;
121 + return [shortLog, formattedLog];
122 }
123
124 async function getPreviousCommitSha() {