Merge pull request #1413 from slumbering/bump-docusaurus-beta.14
[Docs] Update docusaurus to beta-14
This commit is contained in:
commit
5bfb27a98c
@ -70,10 +70,6 @@ module.exports = {
|
|||||||
lightIcon: "img/Icon_Day-mode.svg",
|
lightIcon: "img/Icon_Day-mode.svg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
gtag: {
|
|
||||||
trackingID: "G-RDXG80F635",
|
|
||||||
anonymizeIP: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
@ -82,10 +78,14 @@ module.exports = {
|
|||||||
docs: {
|
docs: {
|
||||||
path: "../docs",
|
path: "../docs",
|
||||||
sidebarPath: require.resolve("./sidebars.js"),
|
sidebarPath: require.resolve("./sidebars.js"),
|
||||||
editUrl: "https://github.com/dagger/dagger/blob/main",
|
editUrl: "https://github.com/dagger/dagger/edit/main/website",
|
||||||
routeBasePath: "/",
|
routeBasePath: "/",
|
||||||
remarkPlugins: [remarkCodeImport],
|
remarkPlugins: [remarkCodeImport],
|
||||||
},
|
},
|
||||||
|
gtag: {
|
||||||
|
trackingID: "G-RDXG80F635",
|
||||||
|
anonymizeIP: true,
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
customCss: require.resolve("./src/css/custom.scss"),
|
customCss: require.resolve("./src/css/custom.scss"),
|
||||||
},
|
},
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
"ci": "start-server-and-test 'yarn start-server' '3000|3001' 'yarn run cypress run'"
|
"ci": "start-server-and-test 'yarn start-server' '3000|3001' 'yarn run cypress run'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "^2.0.0-beta.9",
|
"@docusaurus/core": "^2.0.0-beta.14",
|
||||||
"@docusaurus/preset-classic": "^2.0.0-beta.9",
|
"@docusaurus/preset-classic": "^2.0.0-beta.14",
|
||||||
"@mdx-js/react": "^1.6.21",
|
"@mdx-js/react": "^1.6.21",
|
||||||
"@svgr/webpack": "^5.5.0",
|
"@svgr/webpack": "^5.5.0",
|
||||||
"amplitude-js": "^8.15.0",
|
"amplitude-js": "^8.15.0",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import React, {useState, useCallback, useEffect} from 'react';
|
import React, {useState, useEffect, useCallback} from 'react';
|
||||||
import {MDXProvider} from '@mdx-js/react';
|
import {MDXProvider} from '@mdx-js/react';
|
||||||
import renderRoutes from '@docusaurus/renderRoutes';
|
import renderRoutes from '@docusaurus/renderRoutes';
|
||||||
import Layout from '@theme/Layout';
|
import Layout from '@theme/Layout';
|
||||||
@ -17,16 +17,25 @@ import {matchPath} from '@docusaurus/router';
|
|||||||
import {translate} from '@docusaurus/Translate';
|
import {translate} from '@docusaurus/Translate';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
import {ThemeClassNames, docVersionSearchTag} from '@docusaurus/theme-common';
|
import {
|
||||||
|
ThemeClassNames,
|
||||||
|
docVersionSearchTag,
|
||||||
|
DocsSidebarProvider,
|
||||||
|
useDocsSidebar,
|
||||||
|
DocsVersionProvider,
|
||||||
|
} from '@docusaurus/theme-common';
|
||||||
|
import Head from '@docusaurus/Head';
|
||||||
import DocPageCustom from "../../components/DocPageCustom"
|
import DocPageCustom from "../../components/DocPageCustom"
|
||||||
import amplitude from 'amplitude-js';
|
import amplitude from 'amplitude-js';
|
||||||
|
|
||||||
function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
function DocPageContent({
|
||||||
|
currentDocRoute,
|
||||||
|
versionMetadata,
|
||||||
|
children,
|
||||||
|
sidebarName,
|
||||||
|
}) {
|
||||||
|
const sidebar = useDocsSidebar();
|
||||||
const {pluginId, version} = versionMetadata;
|
const {pluginId, version} = versionMetadata;
|
||||||
const sidebarName = currentDocRoute.sidebar;
|
|
||||||
const sidebar = sidebarName
|
|
||||||
? versionMetadata.docsSidebars[sidebarName]
|
|
||||||
: undefined;
|
|
||||||
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
||||||
const [hiddenSidebar, setHiddenSidebar] = useState(false);
|
const [hiddenSidebar, setHiddenSidebar] = useState(false);
|
||||||
const toggleSidebar = useCallback(() => {
|
const toggleSidebar = useCallback(() => {
|
||||||
@ -34,13 +43,13 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|||||||
setHiddenSidebar(false);
|
setHiddenSidebar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
setHiddenSidebarContainer(!hiddenSidebarContainer);
|
setHiddenSidebarContainer((value) => !value);
|
||||||
}, [hiddenSidebar]);
|
}, [hiddenSidebar]);
|
||||||
return (
|
return (
|
||||||
<Layout
|
<Layout
|
||||||
wrapperClassName={ThemeClassNames.wrapper.docPages}
|
wrapperClassName={ThemeClassNames.wrapper.docsPages}
|
||||||
pageClassName={ThemeClassNames.page.docsDocPage}
|
pageClassName={ThemeClassNames.page.docsDocPage}
|
||||||
searchMetadatas={{
|
searchMetadata={{
|
||||||
version,
|
version,
|
||||||
tag: docVersionSearchTag(pluginId, version),
|
tag: docVersionSearchTag(pluginId, version),
|
||||||
}}>
|
}}>
|
||||||
@ -157,19 +166,34 @@ function DocPage(props) {
|
|||||||
// End DocPageSwizzle
|
// End DocPageSwizzle
|
||||||
|
|
||||||
if (!currentDocRoute) {
|
if (!currentDocRoute) {
|
||||||
return <NotFound {...props} />;
|
return <NotFound />;
|
||||||
}
|
} // For now, the sidebarName is added as route config: not ideal!
|
||||||
|
|
||||||
|
const sidebarName = currentDocRoute.sidebar;
|
||||||
|
const sidebar = sidebarName
|
||||||
|
? versionMetadata.docsSidebars[sidebarName]
|
||||||
|
: null;
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Head>
|
||||||
|
{/* TODO we should add a core addRoute({htmlClassName}) generic plugin option */}
|
||||||
|
<html className={versionMetadata.className} />
|
||||||
|
</Head>
|
||||||
|
<DocsVersionProvider version={versionMetadata}>
|
||||||
|
<DocsSidebarProvider sidebar={sidebar}>
|
||||||
<DocPageContent
|
<DocPageContent
|
||||||
currentDocRoute={currentDocRoute}
|
currentDocRoute={currentDocRoute}
|
||||||
versionMetadata={versionMetadata}>
|
versionMetadata={versionMetadata}
|
||||||
|
sidebarName={sidebarName}>
|
||||||
<div data-cy="cy-doc-content">
|
<div data-cy="cy-doc-content">
|
||||||
{renderRoutes(docRoutes, {
|
{renderRoutes(docRoutes, {
|
||||||
versionMetadata,
|
versionMetadata,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</DocPageContent>
|
</DocPageContent>
|
||||||
|
</DocsSidebarProvider>
|
||||||
|
</DocsVersionProvider>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1980
website/yarn.lock
1980
website/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user