electron/script/release/notes/index.js

187 lines
5.7 KiB
JavaScript
Raw Normal View History

better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
#!/usr/bin/env node
2020-03-20 20:28:31 +00:00
const { GitProcess } = require('dugite');
const minimist = require('minimist');
const path = require('path');
const semver = require('semver');
2018-06-21 08:06:23 +00:00
2020-03-20 20:28:31 +00:00
const { ELECTRON_DIR } = require('../../lib/utils');
const notesGenerator = require('./notes.js');
2018-06-21 08:06:23 +00:00
const semverify = version => version.replace(/^origin\//, '').replace(/[xy]/g, '0').replace(/-/g, '.');
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const runGit = async (args) => {
2020-03-20 20:28:31 +00:00
const response = await GitProcess.exec(args, ELECTRON_DIR);
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (response.exitCode !== 0) {
2020-03-20 20:28:31 +00:00
throw new Error(response.stderr.trim());
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
return response.stdout.trim();
};
2018-06-21 08:06:23 +00:00
2020-03-20 20:28:31 +00:00
const tagIsSupported = tag => tag && !tag.includes('nightly') && !tag.includes('unsupported');
const tagIsBeta = tag => tag.includes('beta');
const tagIsStable = tag => tagIsSupported(tag) && !tagIsBeta(tag);
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getTagsOf = async (point) => {
return (await runGit(['tag', '--merged', point]))
.split('\n')
.map(tag => tag.trim())
.filter(tag => semver.valid(tag))
2020-03-20 20:28:31 +00:00
.sort(semver.compare);
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getTagsOnBranch = async (point) => {
2020-03-20 20:28:31 +00:00
const masterTags = await getTagsOf('master');
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (point === 'master') {
2020-03-20 20:28:31 +00:00
return masterTags;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
const masterTagsSet = new Set(masterTags);
return (await getTagsOf(point)).filter(tag => !masterTagsSet.has(tag));
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getBranchOf = async (point) => {
const branches = (await runGit(['branch', '-a', '--contains', point]))
.split('\n')
.map(branch => branch.trim())
2020-03-20 20:28:31 +00:00
.filter(branch => !!branch);
const current = branches.find(branch => branch.startsWith('* '));
return current ? current.slice(2) : branches.shift();
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getAllBranches = async () => {
return (await runGit(['branch', '--remote']))
.split('\n')
.map(branch => branch.trim())
.filter(branch => !!branch)
.filter(branch => branch !== 'origin/HEAD -> origin/master')
2020-03-20 20:28:31 +00:00
.sort();
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getStabilizationBranches = async () => {
return (await getAllBranches())
.filter(branch => /^origin\/\d+-\d+-x$/.test(branch) || /^origin\/\d+-x-y$/.test(branch));
2020-03-20 20:28:31 +00:00
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getPreviousStabilizationBranch = async (current) => {
const stabilizationBranches = (await getStabilizationBranches())
2020-03-20 20:28:31 +00:00
.filter(branch => branch !== current && branch !== `origin/${current}`);
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (!semver.valid(current)) {
// since we don't seem to be on a stabilization branch right now,
// pick a placeholder name that will yield the newest branch
// as a comparison point.
2020-03-20 20:28:31 +00:00
current = 'v999.999.999';
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
let newestMatch = null;
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
for (const branch of stabilizationBranches) {
if (semver.gte(semverify(branch), semverify(current))) {
2020-03-20 20:28:31 +00:00
continue;
2018-06-21 08:06:23 +00:00
}
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (newestMatch && semver.lte(semverify(branch), semverify(newestMatch))) {
2020-03-20 20:28:31 +00:00
continue;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
newestMatch = branch;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
return newestMatch;
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const getPreviousPoint = async (point) => {
2020-03-20 20:28:31 +00:00
const currentBranch = await getBranchOf(point);
const currentTag = (await getTagsOf(point)).filter(tag => tagIsSupported(tag)).pop();
const currentIsStable = tagIsStable(currentTag);
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
try {
// First see if there's an earlier tag on the same branch
// that can serve as a reference point.
2020-03-20 20:28:31 +00:00
let tags = (await getTagsOnBranch(`${point}^`)).filter(tag => tagIsSupported(tag));
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (currentIsStable) {
2020-03-20 20:28:31 +00:00
tags = tags.filter(tag => tagIsStable(tag));
2018-06-21 08:06:23 +00:00
}
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (tags.length) {
2020-03-20 20:28:31 +00:00
return tags.pop();
2018-06-21 08:06:23 +00:00
}
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
} catch (error) {
2020-03-20 20:28:31 +00:00
console.log('error', error);
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
}
// Otherwise, use the newest stable release that preceeds this branch.
// To reach that you may have to walk past >1 branch, e.g. to get past
// 2-1-x which never had a stable release.
2020-03-20 20:28:31 +00:00
let branch = currentBranch;
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
while (branch) {
2020-03-20 20:28:31 +00:00
const prevBranch = await getPreviousStabilizationBranch(branch);
const tags = (await getTagsOnBranch(prevBranch)).filter(tag => tagIsStable(tag));
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (tags.length) {
2020-03-20 20:28:31 +00:00
return tags.pop();
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
branch = prevBranch;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
};
2018-06-21 08:06:23 +00:00
async function getReleaseNotes (range, newVersion, explicitLinks) {
2020-03-20 20:28:31 +00:00
const rangeList = range.split('..') || ['HEAD'];
const to = rangeList.pop();
const from = rangeList.pop() || (await getPreviousPoint(to));
2018-06-21 08:06:23 +00:00
if (!newVersion) {
2020-03-20 20:28:31 +00:00
newVersion = to;
}
2020-03-20 20:28:31 +00:00
console.log(`Generating release notes between ${from} and ${to} for version ${newVersion}`);
const notes = await notesGenerator.get(from, to, newVersion);
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
const ret = {
text: notesGenerator.render(notes, explicitLinks)
2020-03-20 20:28:31 +00:00
};
2018-06-21 08:06:23 +00:00
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (notes.unknown.length) {
2020-03-20 20:28:31 +00:00
ret.warning = `You have ${notes.unknown.length} unknown release notes. Please fix them before releasing.`;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
return ret;
2018-06-21 08:06:23 +00:00
}
2018-06-21 08:13:19 +00:00
async function main () {
const opts = minimist(process.argv.slice(2), {
boolean: ['explicit-links', 'help'],
string: ['version']
2020-03-20 20:28:31 +00:00
});
opts.range = opts._.shift();
if (opts.help || !opts.range) {
2020-03-20 20:28:31 +00:00
const name = path.basename(process.argv[1]);
console.log(`
easy usage: ${name} version
full usage: ${name} [begin..]end [--version version] [--explicit-links]
* '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
${process.argv[1]} v4.0.0..v4.0.1 --version v4.0.1
2020-03-20 20:28:31 +00:00
`);
return 0;
2018-06-21 08:06:23 +00:00
}
2020-03-20 20:28:31 +00:00
const notes = await getReleaseNotes(opts.range, opts.version, opts['explicit-links']);
console.log(notes.text);
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
if (notes.warning) {
2020-03-20 20:28:31 +00:00
throw new Error(notes.warning);
2018-06-21 08:06:23 +00:00
}
}
if (process.mainModule === module) {
main().catch((err) => {
2020-03-20 20:28:31 +00:00
console.error('Error Occurred:', err);
process.exit(1);
});
2018-06-21 08:06:23 +00:00
}
better release notes (#15169) * fix: use PR 'Notes' comment in release notes * fix: follow links in roller-bot PRs * refactor: better reference point version selection * if we're a stable release, use the current brnach's previous stable * if we're a beta release, use the current branch's previous beta * if no match found, use the newest stable that precedes this branch * refactor: dedup the caching functions' code * refactor: partially rewrite release note generator * parse release notes comments from PRs * do not display no-notes PRs * handle roller-bot commits by following cross-repo commits/PRs * minor tweaks to note rendering, e.g. capitalization * fix: fix lint:js script typo * fix: copy originalPr value to rollerbot PR chains * fix: handle more cases in release notes generator * handle force-pushes where no PR * better type guessing on pre-semantic commits * fix: handle more edge cases in the note generator * better removal of commits that landed before the reference point * ensure '<!-- One-line Change Summary Here-->' is removed from notes * handle more legacy commit body notes e.g. "Chore(docs)" * check for fix markdown in PR body e.g. a link to the issue page * chore: tweak code comments * refactor: easier note generator command-line args * refactor: group related notes together * feat: query commits locally for gyp and gn deps * chore: slightly better filtering of old commits * feat: omit submodule commits for .0.0 releases More specifically, only include them if generating release notes relative to another release on the same branch. Before that first release, there's just too much churn. * refactor: make release-notes usable as a module Calling it from the command line and from require()() now do pretty much the same thing. * refactor: passing command-line args means use HEAD * chore: plug in the release note generator * feat: support multiline 'Notes:' messages. xref: https://github.com/electron/trop/pull/56 xref: https://github.com/electron/clerk/pull/16 * remove accidental change in package.json * simplify an overcomplicated require() call * Don't use PascalCase on releaseNotesGenerator() * Remove code duplication in release notes warnings * remove commented-out code. * don't use single-character variable names. For example, use 'tag' instead of 't'. The latter was being used for map/filter arrow function args. * Look for 'backport' rather than 'ackport'. * Wrap all block statements in curly braces. * fix tyop * fix oops * Check semver validity before calling semver.sort()
2018-11-06 20:06:11 +00:00
2020-03-20 20:28:31 +00:00
module.exports = getReleaseNotes;