Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(content-docs): refactor sidebars, Joi validation, generator rework, expose config types #5678

Merged
merged 17 commits into from
Oct 14, 2021
Merged
7 changes: 6 additions & 1 deletion packages/create-docusaurus/templates/shared/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
Create as many sidebars as you want.
*/

module.exports = {
// @ts-check

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice idea :)

const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],

Expand All @@ -24,3 +27,5 @@ module.exports = {
],
*/
};

module.exports = sidebars;
3 changes: 2 additions & 1 deletion packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@types/js-yaml": "^4.0.0",
"@types/picomatch": "^2.2.1",
"commander": "^5.1.0",
"picomatch": "^2.1.1"
"picomatch": "^2.1.1",
"utility-types": "^3.10.0"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ import {DEFAULT_PLUGIN_ID} from '@docusaurus/core/lib/constants';
import * as cliDocs from '../cli';
import {OptionsSchema} from '../options';
import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {
DocMetadata,
LoadedVersion,
import type {DocMetadata, LoadedVersion} from '../types';
import type {
SidebarItem,
SidebarItemsGeneratorOption,
SidebarItemsGeneratorOptionArgs,
} from '../types';
} from '../sidebars/types';
import {toSidebarsProp} from '../props';

import {validate} from 'webpack';
import {DefaultSidebarItemsGenerator} from '../sidebarItemsGenerator';
import {DefaultSidebarItemsGenerator} from '../sidebars/generator';
import {DisabledSidebars} from '../sidebars';

function findDocById(version: LoadedVersion, unversionedId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import {OptionsSchema, DEFAULT_OPTIONS, validateOptions} from '../options';
import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {DefaultSidebarItemsGenerator} from '../sidebarItemsGenerator';
import {DefaultSidebarItemsGenerator} from '../sidebars/generator';
import {
DefaultNumberPrefixParser,
DisabledNumberPrefixParser,
Expand Down
Loading