2018-11-06 20:06:11 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const childProcess = require('child_process');
|
|
|
|
const fs = require('fs');
|
|
|
|
const os = require('os');
|
|
|
|
const path = require('path');
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const { GitProcess } = require('dugite');
|
2019-05-08 01:48:40 +00:00
|
|
|
const octokit = require('@octokit/rest')({
|
|
|
|
auth: process.env.ELECTRON_GITHUB_TOKEN
|
2020-03-20 20:28:31 +00:00
|
|
|
});
|
|
|
|
const semver = require('semver');
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const { ELECTRON_VERSION, SRC_DIR } = require('../../lib/utils');
|
2019-06-24 17:18:04 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const MAX_FAIL_COUNT = 3;
|
|
|
|
const CHECK_INTERVAL = 5000;
|
2019-05-02 22:08:45 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const CACHE_DIR = path.resolve(__dirname, '.cache');
|
|
|
|
const NO_NOTES = 'No notes';
|
|
|
|
const FOLLOW_REPOS = ['electron/electron', 'electron/node'];
|
2019-01-09 00:20:54 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const breakTypes = new Set(['breaking-change']);
|
|
|
|
const docTypes = new Set(['doc', 'docs']);
|
|
|
|
const featTypes = new Set(['feat', 'feature']);
|
|
|
|
const fixTypes = new Set(['fix']);
|
|
|
|
const otherTypes = new Set(['spec', 'build', 'test', 'chore', 'deps', 'refactor', 'tools', 'vendor', 'perf', 'style', 'ci']);
|
|
|
|
const knownTypes = new Set([...breakTypes.keys(), ...docTypes.keys(), ...featTypes.keys(), ...fixTypes.keys(), ...otherTypes.keys()]);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const runGit = async (dir, args) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const response = await GitProcess.exec(args, dir);
|
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-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return response.stdout.trim();
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const getCommonAncestor = async (dir, point1, point2) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
return runGit(dir, ['merge-base', point1, point2]);
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const setPullRequest = (commit, owner, repo, number) => {
|
|
|
|
if (!owner || !repo || !number) {
|
2020-03-20 20:28:31 +00:00
|
|
|
throw new Error(JSON.stringify({ owner, repo, number }, null, 2));
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!commit.originalPr) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.originalPr = commit.pr;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.pr = { owner, repo, number };
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
if (!commit.originalPr) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.originalPr = commit.pr;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-02-01 16:31:03 +00:00
|
|
|
const getNoteFromClerk = async (number, owner, repo) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const comments = await getComments(number, owner, repo);
|
|
|
|
if (!comments || !comments.data) return;
|
2019-02-01 16:31:03 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const CLERK_LOGIN = 'release-clerk[bot]';
|
|
|
|
const CLERK_NO_NOTES = '**No Release Notes**';
|
|
|
|
const PERSIST_LEAD = '**Release Notes Persisted**\n\n';
|
|
|
|
const QUOTE_LEAD = '> ';
|
2019-02-01 16:31:03 +00:00
|
|
|
|
|
|
|
for (const comment of comments.data.reverse()) {
|
|
|
|
if (comment.user.login !== CLERK_LOGIN) {
|
2020-03-20 20:28:31 +00:00
|
|
|
continue;
|
2019-02-01 16:31:03 +00:00
|
|
|
}
|
2019-02-12 14:21:20 +00:00
|
|
|
if (comment.body === CLERK_NO_NOTES) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return NO_NOTES;
|
2019-02-12 14:21:20 +00:00
|
|
|
}
|
|
|
|
if (comment.body.startsWith(PERSIST_LEAD)) {
|
|
|
|
return comment.body
|
|
|
|
.slice(PERSIST_LEAD.length).trim() // remove PERSIST_LEAD
|
|
|
|
.split('\r?\n') // break into lines
|
|
|
|
.map(line => line.trim())
|
|
|
|
.filter(line => line.startsWith(QUOTE_LEAD)) // notes are quoted
|
|
|
|
.map(line => line.slice(QUOTE_LEAD.length)) // unquote the lines
|
|
|
|
.join(' ') // join the note lines
|
2020-03-20 20:28:31 +00:00
|
|
|
.trim();
|
2019-02-01 16:31:03 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2019-02-01 16:31:03 +00:00
|
|
|
|
2019-01-10 20:01:38 +00:00
|
|
|
// copied from https://github.com/electron/clerk/blob/master/src/index.ts#L4-L13
|
|
|
|
const OMIT_FROM_RELEASE_NOTES_KEYS = [
|
|
|
|
'no-notes',
|
|
|
|
'no notes',
|
|
|
|
'no_notes',
|
|
|
|
'none',
|
|
|
|
'no',
|
|
|
|
'nothing',
|
|
|
|
'empty',
|
|
|
|
'blank'
|
2020-03-20 20:28:31 +00:00
|
|
|
];
|
2019-01-10 20:01:38 +00:00
|
|
|
|
2018-11-06 20:06:11 +00:00
|
|
|
const getNoteFromBody = body => {
|
|
|
|
if (!body) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return null;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const NOTE_PREFIX = 'Notes: ';
|
|
|
|
const NOTE_HEADER = '#### Release Notes';
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
let note = body
|
|
|
|
.split(/\r?\n\r?\n/) // split into paragraphs
|
|
|
|
.map(paragraph => paragraph.trim())
|
2019-02-01 16:31:03 +00:00
|
|
|
.map(paragraph => paragraph.startsWith(NOTE_HEADER) ? paragraph.slice(NOTE_HEADER.length).trim() : paragraph)
|
2020-03-20 20:28:31 +00:00
|
|
|
.find(paragraph => paragraph.startsWith(NOTE_PREFIX));
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
if (note) {
|
|
|
|
note = note
|
|
|
|
.slice(NOTE_PREFIX.length)
|
2019-01-10 20:01:38 +00:00
|
|
|
.replace(/<!--.*-->/, '') // '<!-- change summary here-->'
|
2018-11-06 20:06:11 +00:00
|
|
|
.replace(/\r?\n/, ' ') // remove newlines
|
2020-03-20 20:28:31 +00:00
|
|
|
.trim();
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2019-01-10 20:01:38 +00:00
|
|
|
if (note && OMIT_FROM_RELEASE_NOTES_KEYS.includes(note.toLowerCase())) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return NO_NOTES;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return note;
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Looks for our project's conventions in the commit message:
|
|
|
|
*
|
|
|
|
* 'semantic: some description' -- sets type, subject
|
|
|
|
* 'some description (#99999)' -- sets subject, pr
|
|
|
|
* 'Fixes #3333' -- sets issueNumber
|
|
|
|
* 'Merge pull request #99999 from ${branchname}' -- sets pr
|
|
|
|
* 'This reverts commit ${sha}' -- sets revertHash
|
|
|
|
* line starting with 'BREAKING CHANGE' in body -- sets breakingChange
|
|
|
|
* 'Backport of #99999' -- sets pr
|
|
|
|
*/
|
|
|
|
const parseCommitMessage = (commitMessage, owner, repo, commit = {}) => {
|
|
|
|
// split commitMessage into subject & body
|
2020-03-20 20:28:31 +00:00
|
|
|
let subject = commitMessage;
|
|
|
|
let body = '';
|
|
|
|
const pos = subject.indexOf('\n');
|
2018-11-06 20:06:11 +00:00
|
|
|
if (pos !== -1) {
|
2020-03-20 20:28:31 +00:00
|
|
|
body = subject.slice(pos).trim();
|
|
|
|
subject = subject.slice(0, pos).trim();
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!commit.originalSubject) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.originalSubject = subject;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (body) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.body = body;
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const note = getNoteFromBody(body);
|
|
|
|
if (note) { commit.note = note; }
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if the subject ends in ' (#dddd)', treat it as a pull request id
|
2020-03-20 20:28:31 +00:00
|
|
|
let match;
|
2018-11-06 20:06:11 +00:00
|
|
|
if ((match = subject.match(/^(.*)\s\(#(\d+)\)$/))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
setPullRequest(commit, owner, repo, parseInt(match[2]));
|
|
|
|
subject = match[1];
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if the subject begins with 'word:', treat it as a semantic commit
|
|
|
|
if ((match = subject.match(/^(\w+):\s(.*)$/))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const type = match[1].toLocaleLowerCase();
|
2019-01-10 20:01:38 +00:00
|
|
|
if (knownTypes.has(type)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = type;
|
|
|
|
subject = match[2];
|
2019-01-10 20:01:38 +00:00
|
|
|
}
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check for GitHub commit message that indicates a PR
|
|
|
|
if ((match = subject.match(/^Merge pull request #(\d+) from (.*)$/))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
setPullRequest(commit, owner, repo, parseInt(match[1]));
|
|
|
|
commit.pr.branch = match[2].trim();
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check for a trop comment that indicates a PR
|
|
|
|
if ((match = commitMessage.match(/\bBackport of #(\d+)\b/))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
setPullRequest(commit, owner, repo, parseInt(match[1]));
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// https://help.github.com/articles/closing-issues-using-keywords/
|
|
|
|
if ((match = subject.match(/\b(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved|for)\s#(\d+)\b/))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.issueNumber = parseInt(match[1]);
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!commit.type) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = 'fix';
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// look for 'fixes' in markdown; e.g. 'Fixes [#8952](https://github.com/electron/electron/issues/8952)'
|
|
|
|
if (!commit.issueNumber && ((match = commitMessage.match(/Fixes \[#(\d+)\]\(https:\/\/github.com\/(\w+)\/(\w+)\/issues\/(\d+)\)/)))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.issueNumber = parseInt(match[1]);
|
2018-11-06 20:06:11 +00:00
|
|
|
if (commit.pr && commit.pr.number === commit.issueNumber) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.pr = null;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
if (commit.originalPr && commit.originalPr.number === commit.issueNumber) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.originalPr = null;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
if (!commit.type) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = 'fix';
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://www.conventionalcommits.org/en
|
|
|
|
if (commitMessage
|
2019-02-01 16:31:03 +00:00
|
|
|
.split(/\r?\n/) // split into lines
|
|
|
|
.map(line => line.trim())
|
|
|
|
.some(line => line.startsWith('BREAKING CHANGE'))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = 'breaking-change';
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check for a reversion commit
|
|
|
|
if ((match = body.match(/This reverts commit ([a-f0-9]{40})\./))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.revertHash = match[1];
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Edge case: manual backport where commit has `owner/repo#pull` notation
|
|
|
|
if (commitMessage.toLowerCase().includes('backport') &&
|
|
|
|
((match = commitMessage.match(/\b(\w+)\/(\w+)#(\d+)\b/)))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const [, owner, repo, number] = match;
|
2018-11-06 20:06:11 +00:00
|
|
|
if (FOLLOW_REPOS.includes(`${owner}/${repo}`)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
setPullRequest(commit, owner, repo, number);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edge case: manual backport where commit has a link to the backport PR
|
|
|
|
if (commitMessage.includes('ackport') &&
|
|
|
|
((match = commitMessage.match(/https:\/\/github\.com\/(\w+)\/(\w+)\/pull\/(\d+)/)))) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const [, owner, repo, number] = match;
|
2018-11-06 20:06:11 +00:00
|
|
|
if (FOLLOW_REPOS.includes(`${owner}/${repo}`)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
setPullRequest(commit, owner, repo, number);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Legacy commits: pre-semantic commits
|
|
|
|
if (!commit.type || commit.type === 'chore') {
|
2020-03-20 20:28:31 +00:00
|
|
|
const commitMessageLC = commitMessage.toLocaleLowerCase();
|
2018-11-06 20:06:11 +00:00
|
|
|
if ((match = commitMessageLC.match(/\bchore\((\w+)\):/))) {
|
|
|
|
// example: 'Chore(docs): description'
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = knownTypes.has(match[1]) ? match[1] : 'chore';
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (commitMessageLC.match(/\b(?:fix|fixes|fixed)/)) {
|
|
|
|
// example: 'fix a bug'
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = 'fix';
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (commitMessageLC.match(/\[(?:docs|doc)\]/)) {
|
|
|
|
// example: '[docs]
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = 'doc';
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.subject = subject.trim();
|
|
|
|
return commit;
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const getLocalCommitHashes = async (dir, ref) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const args = ['log', '-z', '--format=%H', ref];
|
|
|
|
return (await runGit(dir, args)).split('\0').map(hash => hash.trim());
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* possible properties:
|
|
|
|
* breakingChange, email, hash, issueNumber, originalSubject, parentHashes,
|
|
|
|
* pr { owner, repo, number, branch }, revertHash, subject, type
|
|
|
|
*/
|
|
|
|
const getLocalCommitDetails = async (module, point1, point2) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const { owner, repo, dir } = module;
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const fieldSep = '||';
|
|
|
|
const format = ['%H', '%P', '%aE', '%B'].join(fieldSep);
|
|
|
|
const args = ['log', '-z', '--cherry-pick', '--right-only', '--first-parent', `--format=${format}`, `${point1}..${point2}`];
|
|
|
|
const commits = (await runGit(dir, args)).split('\0').map(field => field.trim());
|
|
|
|
const details = [];
|
2018-11-06 20:06:11 +00:00
|
|
|
for (const commit of commits) {
|
|
|
|
if (!commit) {
|
2020-03-20 20:28:31 +00:00
|
|
|
continue;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
const [hash, parentHashes, email, commitMessage] = commit.split(fieldSep, 4).map(field => field.trim());
|
2018-11-06 20:06:11 +00:00
|
|
|
details.push(parseCommitMessage(commitMessage, owner, repo, {
|
|
|
|
email,
|
|
|
|
hash,
|
|
|
|
owner,
|
|
|
|
repo,
|
|
|
|
parentHashes: parentHashes.split()
|
2020-03-20 20:28:31 +00:00
|
|
|
}));
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return details;
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const checkCache = async (name, operation) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const filename = path.resolve(CACHE_DIR, name);
|
2018-11-06 20:06:11 +00:00
|
|
|
if (fs.existsSync(filename)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return JSON.parse(fs.readFileSync(filename, 'utf8'));
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
const response = await operation();
|
2018-11-06 20:06:11 +00:00
|
|
|
if (response) {
|
2020-03-20 20:28:31 +00:00
|
|
|
fs.writeFileSync(filename, JSON.stringify(response));
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return response;
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-05-02 22:08:45 +00:00
|
|
|
// helper function to add some resiliency to volatile GH api endpoints
|
|
|
|
async function runRetryable (fn, maxRetries) {
|
2020-03-20 20:28:31 +00:00
|
|
|
let lastError;
|
2019-05-02 22:08:45 +00:00
|
|
|
for (let i = 0; i < maxRetries; i++) {
|
2018-11-06 20:06:11 +00:00
|
|
|
try {
|
2020-03-20 20:28:31 +00:00
|
|
|
return await fn();
|
2018-11-06 20:06:11 +00:00
|
|
|
} catch (error) {
|
2020-03-20 20:28:31 +00:00
|
|
|
await new Promise((resolve, reject) => setTimeout(resolve, CHECK_INTERVAL));
|
|
|
|
lastError = error;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2019-05-02 22:08:45 +00:00
|
|
|
}
|
|
|
|
// Silently eat 404s.
|
2020-03-20 20:28:31 +00:00
|
|
|
if (lastError.status !== 404) throw lastError;
|
2019-05-02 22:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const getPullRequest = async (number, owner, repo) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const name = `${owner}-${repo}-pull-${number}`;
|
|
|
|
const retryableFunc = () => octokit.pulls.get({ pull_number: number, owner, repo });
|
|
|
|
return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT));
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-02-01 16:31:03 +00:00
|
|
|
const getComments = async (number, owner, repo) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const name = `${owner}-${repo}-issue-${number}-comments`;
|
|
|
|
const retryableFunc = () => octokit.issues.listComments({ issue_number: number, owner, repo, per_page: 100 });
|
|
|
|
return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT));
|
|
|
|
};
|
2019-02-01 16:31:03 +00:00
|
|
|
|
2018-11-06 20:06:11 +00:00
|
|
|
const addRepoToPool = async (pool, repo, from, to) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const commonAncestor = await getCommonAncestor(repo.dir, from, to);
|
|
|
|
const oldHashes = await getLocalCommitHashes(repo.dir, from);
|
|
|
|
oldHashes.forEach(hash => { pool.processedHashes.add(hash); });
|
|
|
|
const commits = await getLocalCommitDetails(repo, commonAncestor, to);
|
|
|
|
pool.commits.push(...commits);
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
**** Other Repos
|
|
|
|
***/
|
|
|
|
|
|
|
|
// other repos - gn
|
|
|
|
|
|
|
|
const getDepsVariable = async (ref, key) => {
|
|
|
|
// get a copy of that reference point's DEPS file
|
2020-03-20 20:28:31 +00:00
|
|
|
const deps = await runGit(ELECTRON_VERSION, ['show', `${ref}:DEPS`]);
|
|
|
|
const filename = path.resolve(os.tmpdir(), 'DEPS');
|
|
|
|
fs.writeFileSync(filename, deps);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
// query the DEPS file
|
|
|
|
const response = childProcess.spawnSync(
|
|
|
|
'gclient',
|
|
|
|
['getdep', '--deps-file', filename, '--var', key],
|
|
|
|
{ encoding: 'utf8' }
|
2020-03-20 20:28:31 +00:00
|
|
|
);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
// cleanup
|
2020-03-20 20:28:31 +00:00
|
|
|
fs.unlinkSync(filename);
|
|
|
|
return response.stdout.trim();
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
|
|
|
const repos = [{ // just node
|
|
|
|
owner: 'electron',
|
|
|
|
repo: 'node',
|
2019-06-24 17:18:04 +00:00
|
|
|
dir: path.resolve(SRC_DIR, 'third_party', 'electron_node'),
|
2018-11-06 20:06:11 +00:00
|
|
|
deps_variable_name: 'node_version'
|
2020-03-20 20:28:31 +00:00
|
|
|
}];
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
for (const repo of repos) {
|
|
|
|
// the 'DEPS' file holds the dependency reference point
|
2020-03-20 20:28:31 +00:00
|
|
|
const key = repo.deps_variable_name;
|
|
|
|
const from = await getDepsVariable(fromRef, key);
|
|
|
|
const to = await getDepsVariable(toRef, key);
|
|
|
|
await addRepoToPool(pool, repo, from, to);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-02-01 16:31:03 +00:00
|
|
|
// Changes are interesting if they make a change relative to a previous
|
|
|
|
// release in the same series. For example if you fix a Y.0.0 bug, that
|
|
|
|
// should be included in the Y.0.1 notes even if it's also tropped back
|
|
|
|
// to X.0.1.
|
|
|
|
//
|
|
|
|
// The phrase 'previous release' is important: if this is the first
|
|
|
|
// prerelease or first stable release in a series, we omit previous
|
|
|
|
// branches' changes. Otherwise we will have an overwhelmingly long
|
|
|
|
// list of mostly-irrelevant changes.
|
|
|
|
const shouldIncludeMultibranchChanges = (version) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
let show = true;
|
2019-02-01 16:31:03 +00:00
|
|
|
|
|
|
|
if (semver.valid(version)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const prerelease = semver.prerelease(version);
|
2019-02-01 16:31:03 +00:00
|
|
|
show = prerelease
|
|
|
|
? parseInt(prerelease.pop()) > 1
|
2020-03-20 20:28:31 +00:00
|
|
|
: semver.patch(version) > 0;
|
2019-02-01 16:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return show;
|
|
|
|
};
|
2019-02-01 16:31:03 +00:00
|
|
|
|
2018-11-06 20:06:11 +00:00
|
|
|
/***
|
|
|
|
**** Main
|
|
|
|
***/
|
|
|
|
|
2019-01-10 20:01:38 +00:00
|
|
|
const getNotes = async (fromRef, toRef, newVersion) => {
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!fs.existsSync(CACHE_DIR)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
fs.mkdirSync(CACHE_DIR);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const pool = {
|
|
|
|
processedHashes: new Set(),
|
|
|
|
commits: []
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
// get the electron/electron commits
|
2020-03-20 20:28:31 +00:00
|
|
|
const electron = { owner: 'electron', repo: 'electron', dir: ELECTRON_VERSION };
|
|
|
|
await addRepoToPool(pool, electron, fromRef, toRef);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
// Don't include submodules if comparing across major versions;
|
|
|
|
// there's just too much churn otherwise.
|
|
|
|
const includeDeps = semver.valid(fromRef) &&
|
|
|
|
semver.valid(toRef) &&
|
2020-03-20 20:28:31 +00:00
|
|
|
semver.major(fromRef) === semver.major(toRef);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
if (includeDeps) {
|
2020-03-20 20:28:31 +00:00
|
|
|
await getDependencyCommitsGN(pool, fromRef, toRef);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// remove any old commits
|
2020-03-20 20:28:31 +00:00
|
|
|
pool.commits = pool.commits.filter(commit => !pool.processedHashes.has(commit.hash));
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
// if a commmit _and_ revert occurred in the unprocessed set, skip them both
|
|
|
|
for (const commit of pool.commits) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const revertHash = commit.revertHash;
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!revertHash) {
|
2020-03-20 20:28:31 +00:00
|
|
|
continue;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const revert = pool.commits.find(commit => commit.hash === revertHash);
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!revert) {
|
2020-03-20 20:28:31 +00:00
|
|
|
continue;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.note = NO_NOTES;
|
|
|
|
revert.note = NO_NOTES;
|
|
|
|
pool.processedHashes.add(commit.hash);
|
|
|
|
pool.processedHashes.add(revertHash);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// scrape PRs for release note 'Notes:' comments
|
|
|
|
for (const commit of pool.commits) {
|
2020-03-20 20:28:31 +00:00
|
|
|
let pr = commit.pr;
|
2019-02-01 16:31:03 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
let prSubject;
|
2018-11-06 20:06:11 +00:00
|
|
|
while (pr && !commit.note) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const note = await getNoteFromClerk(pr.number, pr.owner, pr.repo);
|
2019-02-01 16:31:03 +00:00
|
|
|
if (note) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.note = note;
|
2019-02-01 16:31:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if we already have all the data we need, stop scraping the PRs
|
|
|
|
if (commit.note && commit.type && prSubject) {
|
2020-03-20 20:28:31 +00:00
|
|
|
break;
|
2019-02-01 16:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const prData = await getPullRequest(pr.number, pr.owner, pr.repo);
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!prData || !prData.data) {
|
2020-03-20 20:28:31 +00:00
|
|
|
break;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// try to pull a release note from the pull comment
|
2020-03-20 20:28:31 +00:00
|
|
|
const prParsed = parseCommitMessage(`${prData.data.title}\n\n${prData.data.body}`, pr.owner, pr.repo);
|
2019-02-13 05:30:39 +00:00
|
|
|
if (!commit.note) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.note = prParsed.note;
|
2019-02-13 05:30:39 +00:00
|
|
|
}
|
|
|
|
if (!commit.type || prParsed.type === 'breaking-change') {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.type = prParsed.type;
|
2019-02-13 05:30:39 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
prSubject = prSubject || prParsed.subject;
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
pr = prParsed.pr && (prParsed.pr.number !== pr.number) ? prParsed.pr : null;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2019-01-10 20:01:38 +00:00
|
|
|
|
|
|
|
// if we still don't have a note, it's because someone missed a 'Notes:
|
|
|
|
// comment in a PR somewhere... use the PR subject as a fallback.
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.note = commit.note || prSubject;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2019-01-10 20:01:38 +00:00
|
|
|
// remove non-user-facing commits
|
2018-11-06 20:06:11 +00:00
|
|
|
pool.commits = pool.commits
|
|
|
|
.filter(commit => commit.note !== NO_NOTES)
|
2020-03-20 20:28:31 +00:00
|
|
|
.filter(commit => !((commit.note || commit.subject).match(/^[Bb]ump v\d+\.\d+\.\d+/)));
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-02-01 16:31:03 +00:00
|
|
|
if (!shouldIncludeMultibranchChanges(newVersion)) {
|
2019-01-10 20:01:38 +00:00
|
|
|
// load all the prDatas
|
|
|
|
await Promise.all(
|
2020-03-20 15:12:18 +00:00
|
|
|
pool.commits.map(commit => (async () => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const { pr } = commit;
|
2019-01-10 20:01:38 +00:00
|
|
|
if (typeof pr === 'object') {
|
2020-03-20 20:28:31 +00:00
|
|
|
const prData = await getPullRequest(pr.number, pr.owner, pr.repo);
|
2019-01-10 20:01:38 +00:00
|
|
|
if (prData) {
|
2020-03-20 20:28:31 +00:00
|
|
|
commit.prData = prData;
|
2019-01-10 20:01:38 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 15:12:18 +00:00
|
|
|
})())
|
2020-03-20 20:28:31 +00:00
|
|
|
);
|
2019-01-10 20:01:38 +00:00
|
|
|
|
|
|
|
// remove items that already landed in a previous major/minor series
|
|
|
|
pool.commits = pool.commits
|
|
|
|
.filter(commit => {
|
|
|
|
if (!commit.prData) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return true;
|
2019-01-10 20:01:38 +00:00
|
|
|
}
|
|
|
|
const reducer = (accumulator, current) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
if (!semver.valid(accumulator)) { return current; }
|
|
|
|
if (!semver.valid(current)) { return accumulator; }
|
|
|
|
return semver.lt(accumulator, current) ? accumulator : current;
|
|
|
|
};
|
2019-01-10 20:01:38 +00:00
|
|
|
const earliestRelease = commit.prData.data.labels
|
|
|
|
.map(label => label.name.match(/merged\/(\d+)-(\d+)-x/))
|
|
|
|
.filter(label => !!label)
|
|
|
|
.map(label => `${label[1]}.${label[2]}.0`)
|
2020-03-20 20:28:31 +00:00
|
|
|
.reduce(reducer, null);
|
2019-01-10 20:01:38 +00:00
|
|
|
if (!semver.valid(earliestRelease)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return true;
|
2019-01-10 20:01:38 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return semver.diff(earliestRelease, newVersion).includes('patch');
|
|
|
|
});
|
2019-01-10 20:01:38 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
pool.commits = removeSupercededChromiumUpdates(pool.commits);
|
2019-07-23 20:50:18 +00:00
|
|
|
|
2018-11-06 20:06:11 +00:00
|
|
|
const notes = {
|
2019-01-10 20:01:38 +00:00
|
|
|
breaking: [],
|
2018-11-06 20:06:11 +00:00
|
|
|
docs: [],
|
|
|
|
feat: [],
|
|
|
|
fix: [],
|
|
|
|
other: [],
|
|
|
|
unknown: [],
|
2019-01-10 20:01:38 +00:00
|
|
|
name: newVersion
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
pool.commits.forEach(commit => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const str = commit.type;
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!str) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.unknown.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (breakTypes.has(str)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.breaking.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (docTypes.has(str)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.docs.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (featTypes.has(str)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.feat.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (fixTypes.has(str)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.fix.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else if (otherTypes.has(str)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.other.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.unknown.push(commit);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
});
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return notes;
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2019-07-23 20:50:18 +00:00
|
|
|
const removeSupercededChromiumUpdates = (commits) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const chromiumRegex = /^Updated Chromium to \d+\.\d+\.\d+\.\d+/;
|
|
|
|
const updates = commits.filter(commit => (commit.note || commit.subject).match(chromiumRegex));
|
|
|
|
const keepers = commits.filter(commit => !updates.includes(commit));
|
2019-07-23 20:50:18 +00:00
|
|
|
|
|
|
|
// keep the newest update.
|
|
|
|
if (updates.length) {
|
2020-03-20 20:28:31 +00:00
|
|
|
updates.sort((a, b) => a.originalPr.number - b.originalPr.number);
|
|
|
|
keepers.push(updates.pop());
|
2019-07-23 20:50:18 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return keepers;
|
|
|
|
};
|
2019-07-23 20:50:18 +00:00
|
|
|
|
2018-11-06 20:06:11 +00:00
|
|
|
/***
|
|
|
|
**** Render
|
|
|
|
***/
|
|
|
|
|
2018-12-19 15:48:01 +00:00
|
|
|
const renderLink = (commit, explicitLinks) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
let link;
|
|
|
|
const pr = commit.originalPr;
|
2018-12-19 15:48:01 +00:00
|
|
|
if (pr) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const { owner, repo, number } = pr;
|
|
|
|
const url = `https://github.com/${owner}/${repo}/pull/${number}`;
|
2018-12-19 15:48:01 +00:00
|
|
|
const text = owner === 'electron' && repo === 'electron'
|
|
|
|
? `#${number}`
|
2020-03-20 20:28:31 +00:00
|
|
|
: `${owner}/${repo}#${number}`;
|
|
|
|
link = explicitLinks ? `[${text}](${url})` : text;
|
2018-12-19 15:48:01 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
const { owner, repo, hash } = commit;
|
|
|
|
const url = `https://github.com/${owner}/${repo}/commit/${hash}`;
|
2018-12-19 15:48:01 +00:00
|
|
|
const text = owner === 'electron' && repo === 'electron'
|
|
|
|
? `${hash.slice(0, 8)}`
|
2020-03-20 20:28:31 +00:00
|
|
|
: `${owner}/${repo}@${hash.slice(0, 8)}`;
|
|
|
|
link = explicitLinks ? `[${text}](${url})` : text;
|
2018-12-19 15:48:01 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return link;
|
|
|
|
};
|
2018-12-19 15:48:01 +00:00
|
|
|
|
|
|
|
const renderCommit = (commit, explicitLinks) => {
|
2018-11-06 20:06:11 +00:00
|
|
|
// clean up the note
|
2020-03-20 20:28:31 +00:00
|
|
|
let note = commit.note || commit.subject;
|
|
|
|
note = note.trim();
|
2018-11-06 20:06:11 +00:00
|
|
|
if (note.length !== 0) {
|
2020-03-20 20:28:31 +00:00
|
|
|
note = note[0].toUpperCase() + note.substr(1);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
if (!note.endsWith('.')) {
|
2020-03-20 20:28:31 +00:00
|
|
|
note = note + '.';
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const commonVerbs = {
|
2020-03-20 15:12:18 +00:00
|
|
|
Added: ['Add'],
|
|
|
|
Backported: ['Backport'],
|
|
|
|
Cleaned: ['Clean'],
|
|
|
|
Disabled: ['Disable'],
|
|
|
|
Ensured: ['Ensure'],
|
|
|
|
Exported: ['Export'],
|
|
|
|
Fixed: ['Fix', 'Fixes'],
|
|
|
|
Handled: ['Handle'],
|
|
|
|
Improved: ['Improve'],
|
|
|
|
Made: ['Make'],
|
|
|
|
Removed: ['Remove'],
|
|
|
|
Repaired: ['Repair'],
|
|
|
|
Reverted: ['Revert'],
|
|
|
|
Stopped: ['Stop'],
|
|
|
|
Updated: ['Update'],
|
|
|
|
Upgraded: ['Upgrade']
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
for (const [key, values] of Object.entries(commonVerbs)) {
|
|
|
|
for (const value of values) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const start = `${value} `;
|
2018-11-06 20:06:11 +00:00
|
|
|
if (note.startsWith(start)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
note = `${key} ${note.slice(start.length)}`;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const link = renderLink(commit, explicitLinks);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return { note, link };
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2018-12-19 15:48:01 +00:00
|
|
|
const renderNotes = (notes, explicitLinks) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const rendered = [`# Release Notes for ${notes.name}\n\n`];
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
const renderSection = (title, commits) => {
|
|
|
|
if (commits.length === 0) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return;
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
const notes = new Map();
|
2018-12-19 15:48:01 +00:00
|
|
|
for (const note of commits.map(commit => renderCommit(commit, explicitLinks))) {
|
2018-11-06 20:06:11 +00:00
|
|
|
if (!notes.has(note.note)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.set(note.note, [note.link]);
|
2018-11-06 20:06:11 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
notes.get(note.note).push(note.link);
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
rendered.push(`## ${title}\n\n`);
|
|
|
|
const lines = [];
|
|
|
|
notes.forEach((links, key) => lines.push(` * ${key} ${links.map(link => link.toString()).sort().join(', ')}\n`));
|
|
|
|
rendered.push(...lines.sort(), '\n');
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
renderSection('Breaking Changes', notes.breaking);
|
|
|
|
renderSection('Features', notes.feat);
|
|
|
|
renderSection('Fixes', notes.fix);
|
|
|
|
renderSection('Other Changes', notes.other);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
if (notes.docs.length) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const docs = notes.docs.map(commit => renderLink(commit, explicitLinks)).sort();
|
|
|
|
rendered.push('## Documentation\n\n', ` * Documentation changes: ${docs.join(', ')}\n`, '\n');
|
2018-11-06 20:06:11 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
renderSection('Unknown', notes.unknown);
|
2018-11-06 20:06:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
return rendered.join('');
|
|
|
|
};
|
2018-11-06 20:06:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
**** Module
|
|
|
|
***/
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
get: getNotes,
|
|
|
|
render: renderNotes
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|