chore(plugin-docs): remove legacy versioned prefix on doc ids and sidebar names in versioned sidebars (#9310)

This commit is contained in:
Sébastien Lorber 2023-09-15 18:52:42 +02:00 committed by GitHub
parent f5ae537d3e
commit 598b32011f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 264 additions and 396 deletions

View file

@ -21,7 +21,7 @@ import type {Sidebars} from './sidebars/types';
function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
return {
id: doc.unversionedId,
id: doc.id,
path: doc.permalink,
// optimize global data size: do not add unlisted: false/undefined
@ -56,10 +56,7 @@ function toGlobalSidebars(
path:
firstLink.type === 'generated-index'
? firstLink.permalink
: version.docs.find(
(doc) =>
doc.id === firstLink.id || doc.unversionedId === firstLink.id,
)!.permalink,
: version.docs.find((doc) => doc.id === firstLink.id)!.permalink,
label: firstLink.label,
},
};
@ -76,7 +73,7 @@ export function toGlobalDataVersion(version: FullVersion): GlobalVersion {
docs: version.docs
.map(toGlobalDataDoc)
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
draftIds: version.drafts.map((doc) => doc.unversionedId),
draftIds: version.drafts.map((doc) => doc.id),
sidebars: toGlobalSidebars(version.sidebars, version),
};
}