From f6b5394167cdcad3f3db0628bf8133059e47ec28 Mon Sep 17 00:00:00 2001 From: elrrrrrrr Date: Fri, 23 Feb 2024 15:54:09 +0800 Subject: [PATCH] fix: version sort (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持根据 pre-release 及 metadata 位排序 closes https://github.com/cnpm/cnpmweb/issues/71 --- src/components/NPMVersionSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/NPMVersionSelect.tsx b/src/components/NPMVersionSelect.tsx index 2f2dd74..07c646d 100644 --- a/src/components/NPMVersionSelect.tsx +++ b/src/components/NPMVersionSelect.tsx @@ -18,7 +18,7 @@ function sortNodes(nodes: VersionNode[]): void { if (!aVersion || !bVersion) { return 0; } - return semver.rcompare(aVersion, bVersion); + return semver.rcompare(a.value, b.value); }); for (const node of nodes) { sortNodes(node.children);