From 37ce028e7c9499c35e63c3235a0586f56f9e6747 Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sun, 17 Dec 2023 19:41:39 +1100 Subject: [PATCH] Fix Mod Changes Generation Edge Case + Cleanup (#583) [SKIP] --- tools/tasks/changelog/generateModChanges.ts | 8 +++++--- tools/tasks/misc/createModList.ts | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/tasks/changelog/generateModChanges.ts b/tools/tasks/changelog/generateModChanges.ts index bcf3889..212e0d5 100644 --- a/tools/tasks/changelog/generateModChanges.ts +++ b/tools/tasks/changelog/generateModChanges.ts @@ -17,9 +17,11 @@ const getModChangesFormatting: (commits: Commit[]) => SpecialChangelogFormatting return { formatting: (message, subMessage, indentation, commits) => { // Sub messages are details, so make them bold & italic - if (subMessage) { - return `${indentation}* ***${message}***`; - } + if (subMessage) return `${indentation}* ***${message}***`; + + // Edge Case + if (!commits) return `${indentation}* ${message}`; + if (commits.length > 1) { const authors: string[] = []; const formattedCommits: string[] = []; diff --git a/tools/tasks/misc/createModList.ts b/tools/tasks/misc/createModList.ts index 325f4ac..3ddfac8 100644 --- a/tools/tasks/misc/createModList.ts +++ b/tools/tasks/misc/createModList.ts @@ -30,12 +30,11 @@ export async function createModList(tag = ""): Promise { // Fetch mod/addon & file infos, discard result. Further calls will hit cache. await fetchProjectsBulk(manifest.files.map((mod) => mod.projectID)); await fetchFilesBulk( - // Use this instead of referencing the original array, as .sort sorts the input array - [...manifest.files] - .sort((a, b) => a.fileID - b.fileID) + manifest.files .map((mod) => { return { projectID: mod.projectID, fileID: mod.fileID }; - }), + }) + .sort((a, b) => a.fileID - b.fileID), ); log("Fetched Infos. Creating modlist...");