1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Tools: Improve git-changelog tag detection

This commit is contained in:
Laurent Cozic 2023-06-06 12:04:06 +01:00
parent 19992ffcf9
commit b34342f01e
3 changed files with 18 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;
@ -197,6 +198,11 @@ export const summarizeRenovateMessages = (messages: RenovateMessage[]): string =
return '';
};
const versionFromTag = (tag: string) => {
const s = tag.split('-');
return s[s.length - 1];
};
function filterLogs(logs: LogEntry[], platform: Platform) {
const output: LogEntry[] = [];
const revertedLogs = [];
@ -445,10 +451,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

@ -23,6 +23,7 @@
"@joplin/lib": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/utils": "~2.11",
"compare-versions": "6.0.0-rc.1",
"dayjs": "1.11.7",
"execa": "4.1.0",
"fs-extra": "11.1.1",

View File

@ -5151,6 +5151,7 @@ __metadata:
"@types/node": 18.15.13
"@types/node-fetch": 2.6.3
"@types/yargs": 17.0.24
compare-versions: 6.0.0-rc.1
dayjs: 1.11.7
execa: 4.1.0
fs-extra: 11.1.1
@ -11870,6 +11871,13 @@ __metadata:
languageName: node
linkType: hard
"compare-versions@npm:6.0.0-rc.1":
version: 6.0.0-rc.1
resolution: "compare-versions@npm:6.0.0-rc.1"
checksum: ada8d19dab267ef432e7aea91ff7b4422284e3b44245a4d7b4caaf1353d0279e5f17b3767050e06a9cf84670120d19b427b5191b71b7284a125482fcd1eda789
languageName: node
linkType: hard
"component-emitter@npm:^1.2.1":
version: 1.3.0
resolution: "component-emitter@npm:1.3.0"