Skip to content

Commit

Permalink
docs: version list should follow semver standard (#3210)
Browse files Browse the repository at this point in the history
* docs: version list should follow semver standard

* chore: replace version request
  • Loading branch information
uyarn authored Nov 18, 2024
1 parent ba97cef commit fcd5b58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions site/src/App.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -19,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, [])];
Expand Down Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -95,7 +97,6 @@ function Components() {
};

initHistoryVersions();

}, []);

useEffect(() => {
Expand Down

0 comments on commit fcd5b58

Please sign in to comment.