mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-15 12:36:48 +00:00
[sorting] releases should be sorted by date, then by type (Geth, then Geth + tools) (#158)
* create constant for number of releases per os * sort releases * Apply suggestions from code review * change requests * fix build error * cleanup * fix: typo & prettier * refactor sort function * cleanup unnecessary changes * fix: getReleaseArch case * fix sort * prettier Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Co-authored-by: Nicolás Quiroz <nh.quiroz@gmail.com>
This commit is contained in:
parent
63bbde1747
commit
4aa8f214fb
2 changed files with 11 additions and 6 deletions
|
|
@ -1,13 +1,18 @@
|
||||||
import { ReleaseData } from '../types';
|
import { ReleaseData } from '../types';
|
||||||
|
|
||||||
export const compareReleasesFn = (a: ReleaseData, b: ReleaseData) => {
|
export const compareReleasesFn = (a: ReleaseData, b: ReleaseData) => {
|
||||||
if (new Date(a.published) > new Date(b.published)) {
|
const aPublished = new Date(a.published);
|
||||||
return -1;
|
const bPublished = new Date(b.published);
|
||||||
|
const sameDate = aPublished.toDateString() === bPublished.toDateString();
|
||||||
|
const sameCommit = a.commit.label === b.commit.label;
|
||||||
|
|
||||||
|
if (sameDate && !sameCommit) {
|
||||||
|
return aPublished > bPublished ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new Date(a.published) < new Date(b.published)) {
|
if (sameDate) {
|
||||||
return 1;
|
return a.release.label.length - b.release.label.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return aPublished > bPublished ? -1 : 1;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const getReleaseArch = (filename: string) => {
|
||||||
return 'MIPS32(le)';
|
return 'MIPS32(le)';
|
||||||
case 'mips64':
|
case 'mips64':
|
||||||
return 'MIPS64';
|
return 'MIPS64';
|
||||||
case 'MIPS64(le)':
|
case 'mips64le':
|
||||||
return 'MIPS64(le)';
|
return 'MIPS64(le)';
|
||||||
default:
|
default:
|
||||||
return 'all';
|
return 'all';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue