Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Sort SDK version for dropdown using semver package (#839)
0div4d7eda4f51d9
diff --git a/apps/web/package.json b/apps/web/package.jsonindex 6cb7a7dc1..764c11828 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -59,6 +59,7 @@"remark": "^14.0.2","remark-gfm": "^3.0.1","remark-mdx": "^2.3.0",+ "semver": "^7.7.2","shiki": "^0.11.1","simple-functional-loader": "^1.2.1","tailwind-merge": "^1.14.0",diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsxindex a38b5853f..444da4728 100644--- a/apps/web/src/components/Navigation/index.tsx+++ b/apps/web/src/components/Navigation/index.tsx@@ -1,9 +1,11 @@'use client'+import clsx from 'clsx'import { motion } from 'framer-motion'import { usePathname, useRouter } from 'next/navigation'import React, { useRef, useState } from 'react'+import semver from 'semver'import { useIsInsideMobileNavigation } from '@/components/MobileBurgerMenu'import { useSectionStore } from '@/components/SectionProvider'@@ -98,7 +100,8 @@ function VersionedNavigationGroup({const router = useRouter()// Manage the state of the current version of the SDK reference- const versions = Object.keys(group.versionedItems)+ // and pre-sort them from latest to oldest user semver+ const versions = Object.keys(group.versionedItems)?.sort((a, b) => semver.rcompare(a, b)) ?? []const [curVersion, setCurVersion] = useState(versions[0])// If this is the mobile navigation then we always render the initialdiff --git a/apps/web/src/components/SdkVersionSelect.tsx b/apps/web/src/components/SdkVersionSelect.tsxindex 20d85f5c9..957113ecf 100644--- a/apps/web/src/components/SdkVersionSelect.tsx+++ b/apps/web/src/components/SdkVersionSelect.tsx@@ -9,6 +9,7 @@ export function SdkVersionSelect({versions,onVersionChange,}: Props) {+return (<selectclassName="diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f7db7667a..6c7bc4ff1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -171,6 +171,9 @@ importers:remark-mdx:specifier: ^2.3.0version: 2.3.0+ semver:+ specifier: ^7.7.2+ version: 7.7.2shiki:specifier: ^0.11.1version: 0.11.1@@ -404,7 +407,7 @@ importers:version: 3.1.1(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])vitest-browser-react:specifier: ^0.1.1- version: 0.1.1(@types/[email protected])(@types/[email protected])(@vitest/[email protected]([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected]))+ version: 0.1.1(@types/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected]([email protected]))([email protected])([email protected])packages/python-sdk: {}@@ -5149,10 +5152,6 @@ packages:resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}- resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}- engines: {node: '>=10'}-resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}engines: {node: '>=12'}@@ -5607,6 +5606,7 @@ packages:resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}engines: {node: '>=10.5.0'}+ deprecated: Use your platform's native DOMException insteadresolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}@@ -6496,18 +6496,13 @@ packages:resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}hasBin: true- resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}+ resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==}engines: {node: '>=10'}hasBin: true- resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}- engines: {node: '>=10'}- hasBin: true-- resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==}+ resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==}engines: {node: '>=10'}hasBin: true@@ -6663,6 +6658,7 @@ packages:resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}engines: {node: '>= 8'}+ deprecated: The work that was done in this beta branch won't be included in future versionsresolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}@@ -7958,7 +7954,7 @@ snapshots:package-manager-detector: 0.2.9picocolors: 1.1.1resolve-from: 5.0.0- semver: 7.6.3+ semver: 7.7.1spawndamnit: 3.0.1term-size: 2.2.1@@ -8757,7 +8753,7 @@ snapshots:'@opentelemetry/instrumentation': 0.57.1(@opentelemetry/[email protected])'@opentelemetry/semantic-conventions': 1.28.0forwarded-parse: 2.1.2- semver: 7.7.1+ semver: 7.7.2transitivePeerDependencies:- supports-color@@ -8890,7 +8886,7 @@ snapshots:'@types/shimmer': 1.2.0import-in-the-middle: 1.12.0require-in-the-middle: 7.3.0- semver: 7.7.1+ semver: 7.7.2shimmer: 1.2.1transitivePeerDependencies:- supports-color@@ -8902,7 +8898,7 @@ snapshots:'@types/shimmer': 1.2.0import-in-the-middle: 1.12.0require-in-the-middle: 7.3.0- semver: 7.7.1+ semver: 7.7.2shimmer: 1.2.1transitivePeerDependencies:- supports-color@@ -10318,7 +10314,7 @@ snapshots:graphemer: 1.4.0ignore: 5.2.4natural-compare: 1.4.0- semver: 7.5.4+ semver: 7.7.1ts-api-utils: 1.0.3([email protected])optionalDependencies:typescript: 5.5.3@@ -10465,7 +10461,7 @@ snapshots:globby: 11.1.0is-glob: 4.0.3minimatch: 9.0.3- semver: 7.7.1+ semver: 7.7.2ts-api-utils: 1.0.3([email protected])optionalDependencies:typescript: 5.1.6@@ -10494,7 +10490,7 @@ snapshots:globby: 11.1.0is-glob: 4.0.3minimatch: 9.0.5- semver: 7.6.3+ semver: 7.7.1ts-api-utils: 1.3.0([email protected])optionalDependencies:typescript: 5.1.6@@ -10509,7 +10505,7 @@ snapshots:globby: 11.1.0is-glob: 4.0.3minimatch: 9.0.5- semver: 7.6.3+ semver: 7.7.1ts-api-utils: 1.3.0([email protected])optionalDependencies:typescript: 5.5.3@@ -10525,7 +10521,7 @@ snapshots:'@typescript-eslint/types': 6.21.0'@typescript-eslint/typescript-estree': 6.21.0([email protected])eslint: 8.57.1- semver: 7.7.1+ semver: 7.7.2transitivePeerDependencies:- supports-color- typescript@@ -11925,7 +11921,7 @@ snapshots:debug: 4.4.0([email protected])enhanced-resolve: 5.18.1eslint: 8.57.1- eslint-module-utils: 2.8.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))([email protected])+ eslint-module-utils: 2.8.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])eslint-plugin-import: 2.28.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])fast-glob: 3.3.2get-tsconfig: 4.7.0@@ -11937,7 +11933,7 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))([email protected]):+ [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]):dependencies:debug: 3.2.7optionalDependencies:@@ -11958,7 +11954,7 @@ snapshots:doctrine: 2.1.0eslint: 8.57.1eslint-import-resolver-node: 0.3.9- eslint-module-utils: 2.8.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))([email protected])+ eslint-module-utils: 2.8.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])has: 1.0.3is-core-module: 2.13.0is-glob: 4.0.3@@ -13288,10 +13284,6 @@ snapshots:dependencies:yallist: 3.1.1- dependencies:- yallist: 4.0.0-@@ -14004,7 +13996,7 @@ snapshots:dependencies:- semver: 7.7.1+ semver: 7.7.2@@ -14096,7 +14088,7 @@ snapshots:rc-config-loader: 4.1.3remote-git-tags: 3.0.0rimraf: 5.0.5- semver: 7.5.4+ semver: 7.7.1semver-utils: 1.1.4source-map-support: 0.5.21spawn-please: 2.0.2@@ -14134,7 +14126,7 @@ snapshots:rc-config-loader: 4.1.3remote-git-tags: 3.0.0rimraf: 5.0.5- semver: 7.5.4+ semver: 7.7.1semver-utils: 1.1.4source-map-support: 0.5.21spawn-please: 2.0.2@@ -15075,14 +15067,10 @@ snapshots:- dependencies:- lru-cache: 6.0.0-- [email protected]: {}-+ [email protected]: {}+dependencies:randombytes: 2.1.0@@ -15125,7 +15113,7 @@ snapshots:detect-libc: 2.0.4node-addon-api: 6.1.0prebuild-install: 7.1.3- semver: 7.7.1+ semver: 7.7.2simple-get: 4.0.1tar-fs: 3.0.10tunnel-agent: 0.6.0@@ -15993,7 +15981,7 @@ snapshots:is-yarn-global: 0.4.1latest-version: 7.0.0pupa: 3.1.0- semver: 7.6.3+ semver: 7.7.1semver-diff: 4.0.0xdg-basedir: 5.1.0@@ -16120,7 +16108,7 @@ snapshots:terser: 5.43.1yaml: 2.5.1- [email protected](@types/[email protected])(@types/[email protected])(@vitest/[email protected]([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])):+ [email protected](@types/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected]([email protected]))([email protected])([email protected]):dependencies:'@vitest/browser': 3.1.1([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected])react: 18.3.1