chore(v2): use single method Lodash packages in docs plugin ()

* chore(v2): use single method Lodash packages in docs plugin

* reorder packages

* TS types nightmare
This commit is contained in:
Bartosz Kaszubowski 2020-04-03 19:24:30 +02:00 committed by GitHub
parent 36f4f9487e
commit b4acb89888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 19 deletions
packages/docusaurus-plugin-content-docs/src

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import _ from 'lodash';
import flatMap from 'lodash.flatmap';
import fs from 'fs-extra';
import importFresh from 'import-fresh';
import {
@ -106,12 +106,12 @@ function normalizeItem(item: SidebarItemRaw): SidebarItem[] {
];
}
if (isCategoryShorthand(item)) {
return _.flatMap(normalizeCategoryShorthand(item), normalizeItem);
return flatMap(normalizeCategoryShorthand(item), normalizeItem);
}
switch (item.type) {
case 'category':
assertIsCategory(item);
return [{...item, items: _.flatMap(item.items, normalizeItem)}];
return [{...item, items: flatMap(item.items, normalizeItem)}];
case 'link':
assertIsLink(item);
return [item];
@ -134,7 +134,7 @@ function normalizeSidebar(sidebars: SidebarRaw): Sidebar {
? sidebar
: normalizeCategoryShorthand(sidebar);
acc[sidebarId] = _.flatMap(normalizedSidebar, normalizeItem);
acc[sidebarId] = flatMap(normalizedSidebar, normalizeItem);
return acc;
},