1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Improve git-changelog tag detection

This commit is contained in:
Laurent Cozic 2023-06-06 10:50:22 +01:00
parent d2104a3ba1
commit 169acace66
3 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@
// (Desktop|Mobile|Android|iOS[CLI): (New|Improved|Fixed): Some message..... (#ISSUE)
import { execCommand, githubUsername } from './tool-utils';
import * as compareVersions from 'compare-versions';
interface LogEntry {
message: string;
@ -91,6 +92,11 @@ function platformFromTag(tagName: string): Platform {
throw new Error(`Could not determine platform from tag: "${tagName}"`);
}
const versionFromTag = (tag: string) => {
const s = tag.split('-');
return s[s.length - 1];
};
function filterLogs(logs: LogEntry[], platform: Platform) {
const output: LogEntry[] = [];
const revertedLogs = [];
@ -311,10 +317,13 @@ function capitalizeFirstLetter(string: string) {
async function findFirstRelevantTag(baseTag: string, platform: Platform, allTags: string[]) {
let baseTagIndex = allTags.indexOf(baseTag);
if (baseTagIndex < 0) baseTagIndex = allTags.length;
const baseVersion = versionFromTag(baseTag);
for (let i = baseTagIndex - 1; i >= 0; i--) {
const tag = allTags[i];
if (platformFromTag(tag) !== platform) continue;
const currentVersion = versionFromTag(tag);
if (compareVersions(baseVersion, currentVersion) <= 0) continue;
try {
const logs = await gitLog(tag);

View File

@ -24,6 +24,7 @@
"@joplin/renderer": "^2.10.2",
"@types/node-fetch": "2.6.2",
"@types/yargs": "17.0.20",
"compare-versions": "3.6.0",
"dayjs": "1.11.7",
"execa": "4.1.0",
"fs-extra": "11.1.0",

View File

@ -5142,6 +5142,7 @@ __metadata:
"@types/node": 18.11.18
"@types/node-fetch": 2.6.2
"@types/yargs": 17.0.20
compare-versions: 3.6.0
dayjs: 1.11.7
execa: 4.1.0
fs-extra: 11.1.0