INNER CODE UNIT · JavaScript
getChangeLog
graphql-community/koa-graphql · resources/gen-changelog.js:68
function getChangeLog() {
const { version } = packageJSON;
let tag = null;
let commitsList = exec(`git rev-list --reverse v${version}..`);
if (commitsList === '') {
const parentPackageJSON = exec('git cat-file blob HEAD~1:package.json');
const parentVersion = JSON.parse(parentPackageJSON).version;
commitsList = exec(`git rev-list --reverse v${parentVersion}..HEAD~1`);
tag = `v${version}`;
}
const date = exec('git log -1 --format=%cd --date=short');
return getCommitsInfo(commitsList.split('\n'))
.then((commitsInfo) => getPRsInfo(commitsInfoToPRs(commitsInfo)))
.then((prsInfo) => genChangeLog(tag, date, prsInfo));
}