diff --git a/apps/web/package.json b/apps/web/package.json index f65e12c..bee4d08 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -13,10 +13,12 @@ "@zk-kit/artifacts": "1.6.0", "jotai": "^2.8.3", "preact": "^10.22.0", - "react-query": "^3.39.3" + "react-query": "^3.39.3", + "semver": "^7.6.2" }, "devDependencies": { "@preact/preset-vite": "^2.8.2", + "@types/semver": "^7.5.8", "typescript": "^5.2.2", "vite": "^5.3.1" } diff --git a/apps/web/src/hooks/useVersions.ts b/apps/web/src/hooks/useVersions.ts index 0e009a1..a3528dd 100644 --- a/apps/web/src/hooks/useVersions.ts +++ b/apps/web/src/hooks/useVersions.ts @@ -1,4 +1,5 @@ import { useQuery } from 'react-query' +import rcompare from 'semver/functions/rcompare' import { owner, repo } from '../constants' import { gh } from '../gh' import { useStore } from './useStore' @@ -19,6 +20,7 @@ export function useVersions() { data .filter(tag => tag.includes(`@zk-kit/${selectedProject}-artifacts@`)) .map(tag => tag.split('@')[2]) - .filter(version => version !== 'latest'), + .filter(version => version !== 'latest') + .sort(rcompare), }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4a2916..edd8add 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,10 +71,16 @@ importers: react-query: specifier: ^3.39.3 version: 3.39.3(react@18.3.1) + semver: + specifier: ^7.6.2 + version: 7.6.2 devDependencies: '@preact/preset-vite': specifier: ^2.8.2 version: 2.8.3(@babel/core@7.24.6)(preact@10.22.0)(vite@5.3.1(@types/node@20.14.0)(terser@5.31.1)) + '@types/semver': + specifier: ^7.5.8 + version: 7.5.8 typescript: specifier: ^5.2.2 version: 5.4.5