From 830887528bd8a530bd2f95a3db909781e8026e8c Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Tue, 3 Sep 2024 06:51:27 +0200 Subject: [PATCH] Upstream made more future-proof (#4083) * Add some logs to verfiy * Verify equals solution * Test for of solution * Code cleanup --- scripts/gh/update/latest-version-of.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/gh/update/latest-version-of.js b/scripts/gh/update/latest-version-of.js index 031f50232..ccbedb5b1 100644 --- a/scripts/gh/update/latest-version-of.js +++ b/scripts/gh/update/latest-version-of.js @@ -24,8 +24,16 @@ module.exports = async ({ exec, github, dependencyName, tag }) => { } }; await exec.exec(`npm dist-tag ls @alfresco/${dependencyName}`, [], options); + let matchedPkgVersion = ''; const tagsType = packageDistTag.split('\n'); - const matchedPkgVersion = tagsType.find((tagType) => tagType.includes(tag))?.split(':')[1].trim(); + for (const tagType of tagsType) { + const tagSplit = tagType.split(':'); + if (tagSplit[0].trim() === tag) { + matchedPkgVersion = tagSplit[1].trim(); + break; + } + } + const latestPkgToUpdate = availablePackages.find((package) => package.name === matchedPkgVersion); if (localVersion === latestPkgToUpdate?.name) {