fix(v2): alpha 62 doc fixes (#3381)

* deprecated nextVersionLabel option

* useActivePlugin failfast option

* remove deprecated option nextVersionLabel

* routeBasePath: '' should be forbidden

* routeBasePath: '' should be forbidden

* Docs: do not show version badge if there is only 1 version: https://github.com/facebook/docusaurus/issues/3362

* allow sidebars file to not exist: fallback to empty sidebars
https://githu.com/facebook/docusaurus/issues/3366
This commit is contained in:
Sébastien Lorber 2020-09-01 16:31:33 +02:00 committed by GitHub
parent 2a3fe86579
commit a4769e3f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 80 additions and 35 deletions

View file

@ -200,9 +200,14 @@ export function loadSidebars(sidebarFilePath: string): Sidebars {
if (!sidebarFilePath) {
throw new Error(`sidebarFilePath not provided: ${sidebarFilePath}`);
}
// sidebars file is optional, some users use docs without sidebars!
// See https://github.com/facebook/docusaurus/issues/3366
if (!fs.existsSync(sidebarFilePath)) {
throw new Error(`No sidebar file exist at path: ${sidebarFilePath}`);
// throw new Error(`No sidebar file exist at path: ${sidebarFilePath}`);
return {};
}
// We don't want sidebars to be cached because of hot reloading.
const sidebarJson = importFresh(sidebarFilePath) as SidebarsJSON;
return normalizeSidebars(sidebarJson);