Skip to content

Commit

Permalink
docs: update to Docusaurus v3 (#6756)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Jan 29, 2024
1 parent a50ff86 commit 35982ca
Show file tree
Hide file tree
Showing 7 changed files with 4,049 additions and 2,107 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
16.20.2
18
7 changes: 5 additions & 2 deletions www/docusaurus.config.js
@@ -1,10 +1,12 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const { themes } = require('prism-react-renderer');
const rbVersion = require('../package.json').version;

const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'React Bootstrap',
Expand Down Expand Up @@ -166,6 +168,7 @@ const config = {
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['bash', 'diff', 'json'],
},
algolia: {
// The application ID provided by Algolia
Expand Down
40 changes: 20 additions & 20 deletions www/package.json
Expand Up @@ -15,33 +15,33 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "^2.4.0",
"@docusaurus/preset-classic": "^2.4.0",
"@docusaurus/theme-common": "^2.4.0",
"@docusaurus/theme-live-codeblock": "^2.4.0",
"@mdx-js/react": "^1.6.22",
"@restart/hooks": "^0.4.9",
"@docusaurus/core": "^3.1.0",
"@docusaurus/preset-classic": "^3.1.0",
"@docusaurus/theme-common": "^3.1.0",
"@docusaurus/theme-live-codeblock": "^3.1.0",
"@mdx-js/react": "^3.0.0",
"@restart/hooks": "^0.4.15",
"ast-types": "^0.14.2",
"bootstrap": "^5.3.0",
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.3",
"bootstrap": "^5.3.2",
"clsx": "^2.1.0",
"docusaurus-plugin-sass": "^0.2.5",
"dom-helpers": "^5.2.1",
"formik": "^2.2.9",
"formik": "^2.4.5",
"holderjs": "^2.9.9",
"lodash.camelcase": "^4.3.0",
"markdown-to-jsx": "^7.2.0",
"prism-react-renderer": "^1.3.5",
"markdown-to-jsx": "^7.4.0",
"prism-react-renderer": "^2.1.0",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-docgen": "^5.4.3",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-docgen": "^7.0.3",
"react-dom": "^18.2.0",
"react-live": "^2.4.1",
"sass": "^1.62.0",
"yup": "^1.0.2"
"sass": "^1.69.7",
"yup": "^1.3.3"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.3",
"@tsconfig/docusaurus": "^2.0.2",
"@docusaurus/module-type-aliases": "^3.1.0",
"@docusaurus/tsconfig": "^3.1.0",
"cross-env": "^7.0.3",
"typescript": "^5.3.3"
},
Expand All @@ -58,6 +58,6 @@
]
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
3 changes: 2 additions & 1 deletion www/plugins/react-docgen-plugin/index.js
Expand Up @@ -29,7 +29,8 @@ module.exports = () => ({
const filePath = path.join(srcPath, file);
const buffer = await fs.readFile(filePath);

const output = reactDocgen.parse(buffer, resolveHocComponents, null, {
const output = reactDocgen.parse(buffer, {
resolver: resolveHocComponents,
filename: filePath,
});

Expand Down
9 changes: 2 additions & 7 deletions www/plugins/react-docgen-plugin/resolveHocComponents.js
@@ -1,15 +1,10 @@
const camelCase = require('lodash.camelcase');
const { resolver, utils } = require('react-docgen');
const { namedTypes: types, visit } = require('ast-types');
const buildParser = require('react-docgen/dist/babelParser').default;
const { parse } = require('react-docgen');

const upperFirst = (str) => str[0].toUpperCase() + str.slice(1);

const parser = buildParser({
// Avoid babel complaining about requiring a filename.
filename: 'dummy.ts',
});

module.exports = (ast) => {
let components = resolver.findAllComponentDefinitions(ast);

Expand Down Expand Up @@ -76,7 +71,7 @@ export default class ${upperFirst(
}
`;

let comp = parser.parse(src);
let comp = parse(src);
comp.__src = src;
components = components.concat(
resolver.findExportedComponentDefinition(comp),
Expand Down
4 changes: 2 additions & 2 deletions www/src/components/Markdown.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import BaseMarkdown from 'markdown-to-jsx';
import MDXHead from '@theme-original/MDXComponents/Head';
import Head from '@docusaurus/Head';
import MDXCode from '@theme-original/MDXComponents/Code';
import MDXA from '@theme-original/MDXComponents/A';
import MDXPre from '@theme-original/MDXComponents/Pre';
Expand All @@ -11,7 +11,7 @@ import MDXImg from '@theme-original/MDXComponents/Img';

const MARKDOWN_OPTIONS = {
overrides: {
head: MDXHead,
head: Head,
code: MDXCode,
a: MDXA,
pre: MDXPre,
Expand Down

0 comments on commit 35982ca

Please sign in to comment.