docs: update documentation websites (#5882)

* docs: update next.js to 14.0.4

* update docusaurus to v3.0.1

* update packages dependencies

* added engines

* update lock
This commit is contained in:
Shahed Nasser
2023-12-14 20:43:16 +02:00
committed by GitHub
parent 2d127a4c67
commit 761d2e7a69
10 changed files with 394 additions and 847 deletions

View File

@@ -3,9 +3,6 @@ import bundleAnalyzer from "@next/bundle-analyzer"
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverActions: true,
},
async rewrites() {
return {
fallback: [

View File

@@ -30,7 +30,7 @@
"jsdom": "^22.1.0",
"json-schema": "^0.4.0",
"json-stringify-pretty-compact": "^4.0.0",
"next": "13.4.19",
"next": "^14",
"next-mdx-remote": "^4.4.1",
"openapi-sampler": "^1.3.1",
"openapi-types": "^12.1.3",
@@ -39,7 +39,7 @@
"react": "latest",
"react-dom": "latest",
"react-instantsearch": "^7.0.1",
"react-intersection-observer": "^9.5.2",
"react-intersection-observer": "^9.5.3",
"react-tooltip": "^5.19.0",
"react-transition-group": "^4.4.5",
"slugify": "^1.6.6",
@@ -52,5 +52,8 @@
"devDependencies": {
"@next/bundle-analyzer": "^13.4.19",
"@types/jsdom": "^21.1.1"
},
"engines": {
"node": ">=18.17.0"
}
}

View File

@@ -22,10 +22,11 @@
"@babel/preset-react": "^7.18.6",
"@cloudinary/react": "^1.11.2",
"@cloudinary/url-gen": "^1.9.2",
"@docusaurus/core": "3.0.0",
"@docusaurus/preset-classic": "3.0.0",
"@docusaurus/remark-plugin-npm2yarn": "3.0.0",
"@docusaurus/theme-mermaid": "^3.0.0",
"@docusaurus/core": "3.0.1",
"@docusaurus/preset-classic": "3.0.1",
"@docusaurus/remark-plugin-npm2yarn": "3.0.1",
"@docusaurus/theme-mermaid": "3.0.1",
"@mdx-js/mdx": "3.0.0",
"@mdx-js/react": "3",
"@medusajs/icons": "^1.0.0",
"@svgr/webpack": "6.2.1",
@@ -64,9 +65,9 @@
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.22.15",
"@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/tsconfig": "3.0.0",
"@docusaurus/types": "3.0.0",
"@docusaurus/module-type-aliases": "3.0.1",
"@docusaurus/tsconfig": "3.0.1",
"@docusaurus/types": "3.0.1",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-transition-group": "^4.4.6",

View File

@@ -1,54 +0,0 @@
import React, { memo, useMemo } from "react"
import {
DocSidebarItemsExpandedStateProvider,
isActiveSidebarItem,
} from "@docusaurus/theme-common/internal"
import DocSidebarItem from "@theme/DocSidebarItem"
import type { PropSidebarItem } from "@docusaurus/plugin-content-docs"
import type { Props } from "@theme/DocSidebarItems"
function DocSidebarItems({ items, ...props }: Props): JSX.Element {
// This acts as a fix to a bug in docusaurus which should be part
// of an upcoming release.
function isVisibleSidebarItem(
item: PropSidebarItem,
activePath: string
): boolean {
switch (item.type) {
case "category":
return (
isActiveSidebarItem(item, activePath) ||
item.items.some((subItem) =>
isVisibleSidebarItem(subItem, activePath)
)
)
case "link":
// An unlisted item remains visible if it is active
return !item.unlisted || isActiveSidebarItem(item, activePath)
default:
return true
}
}
function useVisibleSidebarItems(
items: readonly PropSidebarItem[],
activePath: string
): PropSidebarItem[] {
return useMemo(
() => items.filter((item) => isVisibleSidebarItem(item, activePath)),
[items, activePath]
)
}
const visibleItems = useVisibleSidebarItems(items, props.activePath)
return (
<DocSidebarItemsExpandedStateProvider>
{visibleItems.map((item, index) => (
<DocSidebarItem key={index} item={item} index={index} {...props} />
))}
</DocSidebarItemsExpandedStateProvider>
)
}
// Optimize sidebar at each "level"
export default memo(DocSidebarItems)

View File

@@ -30,7 +30,7 @@
"docs-ui": "*",
"eslint-config-docs": "*",
"mdast-util-toc": "^7.0.0",
"next": "13.4.13",
"next": "^14",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.2.1",
"postcss": "8.4.27",
@@ -47,5 +47,8 @@
"eslint": "^8.49.0",
"react-docgen": "^7.0.1",
"ts-node": "^10.9.1"
},
"engines": {
"node": ">=18.17.0"
}
}

View File

@@ -23,5 +23,8 @@
"tailwindcss": "3.3.3",
"tsconfig": "*",
"turbo": "latest"
},
"engines": {
"node": ">=18.17.0"
}
}

View File

@@ -80,6 +80,23 @@ export type ActionType = {
options?: ActionOptionsType
}
const findItem = (
section: SidebarItemType[],
item: Partial<SidebarItemType>,
checkChildren = true
): SidebarItemType | undefined => {
return section.find((i) => {
if (!item.path) {
return !i.path && i.title === item.title
} else {
return (
i.path === item.path ||
(checkChildren && i.children && findItem(i.children, item))
)
}
})
}
export const reducer = (
state: SidebarSectionItemsType,
{ type, items, options }: ActionType
@@ -87,9 +104,20 @@ export const reducer = (
const {
section = SidebarItemSections.TOP,
parent,
ignoreExisting = false,
indexPosition,
} = options || {}
if (!ignoreExisting) {
const selectedSection =
section === SidebarItemSections.BOTTOM ? state.bottom : state.top
items = items.filter((item) => !findItem(selectedSection, item))
}
if (!items.length) {
return state
}
switch (type) {
case "add":
return {
@@ -155,25 +183,7 @@ export const SidebarProvider = ({
return scrollableElement || window
}, [scrollableElement])
const findItemInSection = useCallback(
(
section: SidebarItemType[],
item: Partial<SidebarItemType>,
checkChildren = true
): SidebarItemType | undefined => {
return section.find((i) => {
if (!item.path) {
return !i.path && i.title === item.title
} else {
return (
i.path === item.path ||
(checkChildren && i.children && findItemInSection(i.children, item))
)
}
})
},
[]
)
const findItemInSection = useCallback(findItem, [])
const getActiveItem = useCallback(() => {
if (activePath === null) {
@@ -199,26 +209,8 @@ export const SidebarProvider = ({
ignoreExisting?: boolean
}
) => {
const {
section = SidebarItemSections.TOP,
parent,
ignoreExisting = false,
} = options || {}
if (!ignoreExisting) {
const selectedSection =
section === SidebarItemSections.BOTTOM ? items.bottom : items.top
newItems = newItems.filter(
(item) => !findItemInSection(selectedSection, item)
)
}
if (!newItems.length) {
return
}
dispatch({
type: parent ? "update" : "add",
type: options?.parent ? "update" : "add",
items: newItems,
options,
})

View File

@@ -6,7 +6,7 @@
"main": "base.js",
"dependencies": {
"@babel/eslint-parser": "^7.22.15",
"@docusaurus/eslint-plugin": "latest",
"@docusaurus/eslint-plugin": "3.0.1",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"eslint-config-google": "^0.14.0",

View File

@@ -7,6 +7,6 @@
"access": "public"
},
"dependencies": {
"@docusaurus/tsconfig": "3.0.0"
"@docusaurus/tsconfig": "3.0.1"
}
}

File diff suppressed because it is too large Load Diff