mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
fix(v2): allow relative sidebar path resolution in docs:version command (#4861)
* fix(v2): allow relative sidebar path resolution in docs:version command * factorize sidebarPath option resolution logic + dogfood Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
65cf8dacee
commit
35bdde3409
4 changed files with 26 additions and 6 deletions
|
@ -24,6 +24,7 @@ import {DEFAULT_PLUGIN_ID} from '@docusaurus/core/lib/constants';
|
|||
import {LoadContext} from '@docusaurus/types';
|
||||
import {getPluginI18nPath, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import {difference} from 'lodash';
|
||||
import {resolveSidebarPathOption} from './sidebars';
|
||||
|
||||
// retro-compatibility: no prefix for the default plugin id
|
||||
function addPluginIdPrefix(fileOrDir: string, pluginId: string): string {
|
||||
|
@ -184,9 +185,7 @@ function getVersionMetadataPaths({
|
|||
|
||||
function getSidebarFilePath() {
|
||||
if (isCurrentVersion) {
|
||||
return options.sidebarPath
|
||||
? path.resolve(context.siteDir, options.sidebarPath)
|
||||
: options.sidebarPath;
|
||||
return resolveSidebarPathOption(context.siteDir, options.sidebarPath);
|
||||
} else {
|
||||
return path.join(
|
||||
getVersionedSidebarsDirPath(context.siteDir, options.id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue