mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-13 16:23:34 +02:00
feat(v2): docs versioning ❄️🔥 (#1983)
* wip: versioning * wip again * nits lint * refactor metadata code so that we can have inobject properties optimization, fix typing * remove buggy permalink code * modify versioned docs fixture such that foo/baz only exists in v1.0.0 * refactor metadata.ts so that there is less transformon object * more refactoring * reduce test fixtures, refactoring * refactoring readability * finish metadata part * refactor with readdir * first pass of implementation * fix mdx laoder * split generated routes by version for performance & smaller bundle * test data for demo * refactor with set * more tests * typo * fix typo * better temporary ui * stronger typing & docsVersion command * add 100% test coverage for docsVersion command * more test and delete manual docs cut * cut 2.0.0-alpha.35 docs * cut alpha.36 instead * copyright * delete versioned docs * stronger test on metadata * update typo
This commit is contained in:
parent
c413cff212
commit
9829f56b1e
45 changed files with 1852 additions and 395 deletions
|
@ -5,13 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarItem,
|
||||
SidebarItemDoc,
|
||||
SidebarItemCategory,
|
||||
Order,
|
||||
} from './types';
|
||||
import {Sidebar, SidebarItem, Order} from './types';
|
||||
|
||||
// Build the docs meta such as next, previous, category and sidebar.
|
||||
export default function createOrder(allSidebars: Sidebar = {}): Order {
|
||||
|
@ -26,7 +20,7 @@ export default function createOrder(allSidebars: Sidebar = {}): Order {
|
|||
switch (item.type) {
|
||||
case 'category':
|
||||
indexItems({
|
||||
items: (item as SidebarItemCategory).items,
|
||||
items: item.items,
|
||||
});
|
||||
break;
|
||||
case 'ref':
|
||||
|
@ -34,12 +28,8 @@ export default function createOrder(allSidebars: Sidebar = {}): Order {
|
|||
// Refs and links should not be shown in navigation.
|
||||
break;
|
||||
case 'doc':
|
||||
ids.push((item as SidebarItemDoc).id);
|
||||
ids.push(item.id);
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unknown item type: ${item.type}. Item: ${JSON.stringify(item)}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue