1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

Tools: Improve git-changelog tool

This commit is contained in:
Laurent Cozic 2020-05-10 17:54:18 +01:00
parent 172327613f
commit 347d84526b

View File

@ -47,6 +47,7 @@ function filterLogs(logs, platform) {
const output = [];
const revertedLogs = [];
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
let updatedTranslations = false;
for (const log of logs) {
@ -88,7 +89,8 @@ function filterLogs(logs, platform) {
if (addIt) output.push(log);
}
if (updatedTranslations) output.push({ message: 'Updated translations' });
// Actually we don't really need this info - translations are being updated all the time
// if (updatedTranslations) output.push({ message: 'Updated translations' });
return output;
}
@ -145,7 +147,8 @@ function formatCommitMessage(msg, author, options) {
};
}
let t = parts[0].trim().toLowerCase();
let originalType = parts[0].trim();
let t = originalType.toLowerCase();
parts.splice(0, 1);
let message = parts.join(':').trim();
@ -159,13 +162,26 @@ function formatCommitMessage(msg, author, options) {
t = parts[0].trim().toLowerCase();
parts.splice(0, 1);
message = parts.join(':').trim();
} else if (t.indexOf('resolves') === 0) { // If we didn't have the third token default to "improved"
t = 'improved';
message = parts.join(':').trim();
}
if (t.indexOf('fix') === 0) type = 'fixed';
if (t.indexOf('new') === 0) type = 'new';
if (t.indexOf('improved') === 0) type = 'improved';
if (!type) type = detectType(message);
if (t.indexOf('security') === 0) {
type = 'security';
parts.splice(0, 1);
message = parts.join(':').trim();
}
if (!type) {
type = detectType(message);
if (originalType.toLowerCase() === 'tinymce') originalType = 'WYSIWYG';
message = `${originalType}: ${message}`;
}
let issueNumber = output.match(/#(\d+)/);
issueNumber = issueNumber && issueNumber.length >= 2 ? issueNumber[1] : null;
@ -282,7 +298,7 @@ async function main() {
const changelogNews = [];
for (const l of changelog) {
if (l.indexOf('Fix') === 0) {
if (l.indexOf('Fix') === 0 || l.indexOf('Security') === 0) {
changelogFixes.push(l);
} else if (l.indexOf('Improve') === 0) {
changelogImproves.push(l);
@ -293,6 +309,10 @@ async function main() {
}
}
changelogFixes.sort();
changelogImproves.sort();
changelogNews.sort();
changelog = [].concat(changelogNews).concat(changelogImproves).concat(changelogFixes);
const changelogString = changelog.map(l => `- ${l}`);