react-native-ui-lib 7.42.0-snapshot.7003 → 7.42.0-snapshot.7004
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/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const _ = require('lodash');
|
|
3
|
+
const chalk = require('chalk');
|
|
3
4
|
const childProcess = require('child_process');
|
|
4
5
|
const readline = require('readline');
|
|
5
6
|
|
|
@@ -30,7 +31,7 @@ function parsePR(prContent) {
|
|
|
30
31
|
return PRInfo;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
async function fetchMergedPRs(postMergedDate) {
|
|
34
|
+
async function fetchMergedPRs(postMergedDate, _repo, isPatchRelease) {
|
|
34
35
|
console.log('Find all merged PRs since - ', postMergedDate);
|
|
35
36
|
// process.stderr.write(`Loading page ${page}..`);
|
|
36
37
|
const str = childProcess.execSync('gh pr list --json headRefName,body,title,number,mergedAt,url,labels --limit 100 --state merged --search "base:master"',
|
|
@@ -44,27 +45,35 @@ async function fetchMergedPRs(postMergedDate) {
|
|
|
44
45
|
console.log('\x1b[31m', 'Something went wrong', PRs.message);
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
48
|
+
const filteringMessageStyle = chalk.bgYellow.black;
|
|
49
|
+
console.log(filteringMessageStyle(isPatchRelease
|
|
50
|
+
? 'Patch release - only hotfix PRs will be included.'
|
|
51
|
+
: 'Non-patch release - hotfix PRs will be excluded.'));
|
|
47
52
|
|
|
48
53
|
const relevantPRs = _.flow(prs => _.filter(prs, pr => !!pr.mergedAt && new Date(pr.mergedAt) > postMergedDate),
|
|
54
|
+
prs => _.filter(prs, pr => {
|
|
55
|
+
const isHotfix = pr.labels.some(label => label.name === 'hotfix');
|
|
56
|
+
if (isHotfix && !isPatchRelease) {
|
|
57
|
+
console.log(filteringMessageStyle(`PR ${pr.number} is a hotfix and was excluded from the release notes.`));
|
|
58
|
+
}
|
|
59
|
+
return isPatchRelease ? isHotfix : !isHotfix;
|
|
60
|
+
}),
|
|
49
61
|
prs => _.sortBy(prs, 'mergedAt'),
|
|
50
62
|
prs =>
|
|
51
63
|
_.map(prs, pr => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
64
|
+
try {
|
|
65
|
+
return {
|
|
66
|
+
mergedAt: pr.mergedAt,
|
|
67
|
+
url: pr.url,
|
|
68
|
+
branch: pr.headRefName,
|
|
69
|
+
number: pr.number,
|
|
70
|
+
title: pr.title,
|
|
71
|
+
info: parsePR(pr.body)
|
|
72
|
+
};
|
|
73
|
+
} catch {
|
|
74
|
+
console.error('Failed parsing PR: ', pr.url);
|
|
75
|
+
return null;
|
|
66
76
|
}
|
|
67
|
-
return null;
|
|
68
77
|
}),
|
|
69
78
|
prs => _.compact(prs))(PRs);
|
|
70
79
|
return relevantPRs;
|
|
@@ -155,9 +164,9 @@ function getReleaseNotesForType(PRs, title) {
|
|
|
155
164
|
return releaseNotes;
|
|
156
165
|
}
|
|
157
166
|
|
|
158
|
-
async function _generateReleaseNotes(latestVersion, newVersion, fileNamePrefix, repo, header, tagPrefix, categories) {
|
|
167
|
+
async function _generateReleaseNotes(latestVersion, newVersion, fileNamePrefix, repo, header, tagPrefix, categories, isPatchRelease) {
|
|
159
168
|
const latestReleaseDate = fetchLatestReleaseDate(tagPrefix, latestVersion);
|
|
160
|
-
const PRs = await fetchMergedPRs(latestReleaseDate, repo);
|
|
169
|
+
const PRs = await fetchMergedPRs(latestReleaseDate, repo, isPatchRelease);
|
|
161
170
|
if (!PRs) {
|
|
162
171
|
return;
|
|
163
172
|
}
|
|
@@ -196,6 +205,13 @@ async function _generateReleaseNotes(latestVersion, newVersion, fileNamePrefix,
|
|
|
196
205
|
console.log(`\x1b[1m\x1b[32m✔\x1b[0m \x1b[32m${fileNamePrefix}-release-notes.txt was successfully written to ${process.env.HOME}/Downloads\x1b[0m \x1b[1m\x1b[32m✔\x1b[0m`);
|
|
197
206
|
}
|
|
198
207
|
|
|
208
|
+
function isPatchRelease(lastVersion, newVersion) {
|
|
209
|
+
const [lastMajor, lastMinor, lastPatch] = lastVersion.split('.').map(Number);
|
|
210
|
+
const [newMajor, newMinor, newPatch] = newVersion.split('.').map(Number);
|
|
211
|
+
|
|
212
|
+
return lastMajor === newMajor && lastMinor === newMinor && newPatch - lastPatch > 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
199
215
|
async function generateReleaseNotes(latestVersion,
|
|
200
216
|
newVersion,
|
|
201
217
|
fileNamePrefix,
|
|
@@ -217,11 +233,12 @@ async function generateReleaseNotes(latestVersion,
|
|
|
217
233
|
});
|
|
218
234
|
});
|
|
219
235
|
|
|
236
|
+
|
|
220
237
|
rl.on('close', () => {
|
|
221
238
|
const header = getHeader(newVer);
|
|
222
239
|
console.info(`Current latest version is v${latestVer}`);
|
|
223
240
|
console.info(`Generating release notes out or PRs for v${newVer}`);
|
|
224
|
-
_generateReleaseNotes(latestVer, newVer, fileNamePrefix, repo, header, tagPrefix, categories);
|
|
241
|
+
_generateReleaseNotes(latestVer, newVer, fileNamePrefix, repo, header, tagPrefix, categories, isPatchRelease(latestVer, newVer));
|
|
225
242
|
});
|
|
226
243
|
}
|
|
227
244
|
|