From 14bef711470a0625a6f7322a912a80d5d82b01cf Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Tue, 30 Jul 2024 10:57:42 +0200 Subject: [PATCH] fix: picking correct 6.5 version --- matrix.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/matrix.mjs b/matrix.mjs index ff84635..5de47c3 100644 --- a/matrix.mjs +++ b/matrix.mjs @@ -3,7 +3,18 @@ const swToPHP = await (await fetch('https://raw.githubusercontent.com/FriendsOfS const matrix = []; const alreadyAddedVersion = new Set(); -for (const swVersion of Object.keys(swToPHP).reverse()) { +const customSort = (a, b) => { + const aParts = a.split('.').map(Number); + const bParts = b.split('.').map(Number); + + for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) { + if ((aParts[i] || 0) > (bParts[i] || 0)) return -1; + if ((aParts[i] || 0) < (bParts[i] || 0)) return 1; + } + return 0; +}; + +for (const swVersion of Object.keys(swToPHP).sort(customSort)) { if ((swVersion.indexOf('6.6') !== 0 && swVersion.indexOf('6.5.8') !== 0) || swVersion.indexOf('RC') !== -1) { continue; }