chore: add trop annotations to release notes. (#24672)

Trop annotations are in the form of "(Also in 7.3, 8, 9)" with links to
the sibling branches.

Previously seen in b43e601b83 but is now
free of optional chaining and nullish coalescing, to run on Node < 14 :)
This commit is contained in:
Charles Kerr 2020-07-27 10:01:41 -05:00 committed by GitHub
parent 91f5837344
commit b39a5b71fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 130 additions and 179 deletions

View file

@ -120,7 +120,7 @@ const getPreviousPoint = async (point) => {
}
};
async function getReleaseNotes (range, newVersion, explicitLinks) {
async function getReleaseNotes (range, newVersion) {
const rangeList = range.split('..') || ['HEAD'];
const to = rangeList.pop();
const from = rangeList.pop() || (await getPreviousPoint(to));
@ -129,10 +129,9 @@ async function getReleaseNotes (range, newVersion, explicitLinks) {
newVersion = to;
}
console.log(`Generating release notes between ${from} and ${to} for version ${newVersion}`);
const notes = await notesGenerator.get(from, to, newVersion);
const ret = {
text: notesGenerator.render(notes, explicitLinks)
text: notesGenerator.render(notes)
};
if (notes.unknown.length) {
@ -144,7 +143,7 @@ async function getReleaseNotes (range, newVersion, explicitLinks) {
async function main () {
const opts = minimist(process.argv.slice(2), {
boolean: ['explicit-links', 'help'],
boolean: ['help'],
string: ['version']
});
opts.range = opts._.shift();
@ -153,14 +152,13 @@ async function main () {
console.log(`
easy usage: ${name} version
full usage: ${name} [begin..]end [--version version] [--explicit-links]
full usage: ${name} [begin..]end [--version version]
* 'begin' and 'end' are two git references -- tags, branches, etc --
from which the release notes are generated.
* if omitted, 'begin' defaults to the previous tag in end's branch.
* if omitted, 'version' defaults to 'end'. Specifying a version is
useful if you're making notes on a new version that isn't tagged yet.
* 'explicit-links' makes every note's issue, commit, or pull an MD link
For example, these invocations are equivalent:
${process.argv[1]} v4.0.1
@ -169,7 +167,7 @@ For example, these invocations are equivalent:
return 0;
}
const notes = await getReleaseNotes(opts.range, opts.version, opts['explicit-links']);
const notes = await getReleaseNotes(opts.range, opts.version);
console.log(notes.text);
if (notes.warning) {
throw new Error(notes.warning);