From b960ed456e5cd16324eaf9c5c78a14eedebac22a Mon Sep 17 00:00:00 2001 From: Uyarn Date: Fri, 15 Nov 2024 18:45:19 +0800 Subject: [PATCH 1/2] docs: version list should follow semver standard --- package.json | 1 + site/src/App.jsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 862ec59afa..08d7d74bd4 100644 --- a/package.json +++ b/package.json @@ -183,6 +183,7 @@ "rollup-plugin-styles": "^4.0.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.31.2", + "semver": "^7.6.3", "standard-changelog": "^2.0.27", "start-server-and-test": "^1.14.0", "tdesign-icons-view": "^0.3.0", diff --git a/site/src/App.jsx b/site/src/App.jsx index 3797519ca2..687dce62ef 100644 --- a/site/src/App.jsx +++ b/site/src/App.jsx @@ -1,5 +1,6 @@ import React, { useEffect, useRef, useState, lazy, Suspense } from 'react'; import { BrowserRouter, Routes, Navigate, Route, useLocation, useNavigate, Outlet } from 'react-router-dom'; +import semver from 'semver'; import Loading from 'tdesign-react/loading'; import ConfigProvider from 'tdesign-react/config-provider'; import zhConfig from 'tdesign-react/es/locale/zh_CN'; @@ -65,7 +66,8 @@ function Components() { options.unshift({ label: v, value: v.replace(/\./g, '_') }); }); - tdSelectRef.current.options = options; + + tdSelectRef.current.options = options.sort((a, b) => (semver.gt(a.label, b.label) ? -1 : 1)); }); } @@ -95,7 +97,6 @@ function Components() { }; initHistoryVersions(); - }, []); useEffect(() => { From be07085d8384f0169ed6ce4d00311bbf394f36ea Mon Sep 17 00:00:00 2001 From: Uyarn Date: Mon, 18 Nov 2024 16:04:47 +0800 Subject: [PATCH 2/2] chore: replace version request --- site/src/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/App.jsx b/site/src/App.jsx index 687dce62ef..4032359a81 100644 --- a/site/src/App.jsx +++ b/site/src/App.jsx @@ -20,7 +20,7 @@ const docsMap = { en: enDocs, }; -const registryUrl = 'https://mirrors.tencent.com/npm/tdesign-react'; +const registryUrl = 'https://service-edbzjd6y-1257786608.hk.apigw.tencentcs.com/release/npm/versions/tdesign-react'; const currentVersion = packageJson.version.replace(/\./g, '_'); const docRoutes = [...getRoute(siteConfig.docs, []), ...getRoute(siteConfig.enDocs, [])];