refactor(v2): remove duplicated lodash dependencies and import only what needed (#4361)

Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
Armano 2021-03-09 12:15:52 +01:00 committed by GitHub
parent bac512bc63
commit e6261af642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 22 additions and 142 deletions

View file

@ -25,7 +25,7 @@
"chalk": "^4.1.0",
"commander": "^5.1.0",
"fs-extra": "^9.1.0",
"lodash.kebabcase": "^4.1.1",
"lodash": "^4.17.20",
"prompts": "^2.4.0",
"semver": "^7.3.4",
"shelljs": "^0.8.4"

View file

@ -11,7 +11,7 @@ import {execSync} from 'child_process';
import prompts, {Choice} from 'prompts';
import path from 'path';
import shell from 'shelljs';
import kebabCase from 'lodash.kebabcase';
import {kebabCase} from 'lodash';
function hasYarn(): boolean {
try {

View file

@ -36,12 +36,7 @@
"import-fresh": "^3.2.2",
"joi": "^17.4.0",
"loader-utils": "^1.2.3",
"lodash": "^4.17.19",
"lodash.flatmap": "^4.5.0",
"lodash.groupby": "^4.6.0",
"lodash.pick": "^4.4.0",
"lodash.pickby": "^4.6.0",
"lodash.sortby": "^4.6.0",
"lodash": "^4.17.20",
"remark-admonitions": "^1.2.1",
"shelljs": "^0.8.4",
"utility-types": "^3.10.0",

View file

@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
import flatMap from 'lodash.flatmap';
import fs from 'fs-extra';
import importFresh from 'import-fresh';
import {
@ -18,7 +17,7 @@ import {
SidebarItemCategory,
SidebarItemType,
} from './types';
import {mapValues, flatten, difference} from 'lodash';
import {mapValues, flatten, flatMap, difference} from 'lodash';
import {getElementsAround} from '@docusaurus/utils';
type SidebarItemCategoryJSON = SidebarItemBase & {

View file

@ -26,7 +26,7 @@
"globby": "^11.0.2",
"joi": "^17.4.0",
"loader-utils": "^1.2.3",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"minimatch": "^3.0.4",
"remark-admonitions": "^1.2.1",
"slash": "^3.0.0",

View file

@ -38,7 +38,7 @@
"copy-text-to-clipboard": "^3.0.0",
"infima": "0.2.0-alpha.19",
"joi": "^17.4.0",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"parse-numeric-range": "^1.2.0",
"postcss": "^7.0.2",
"prism-react-renderer": "^1.1.1",

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import merge from 'lodash/merge';
import {merge} from 'lodash';
const {ThemeConfigSchema, DEFAULT_CONFIG} = require('../validateThemeConfig');

View file

@ -22,7 +22,7 @@
"clsx": "^1.1.1",
"eta": "^1.12.1",
"joi": "^17.4.0",
"lodash": "^4.17.19"
"lodash": "^4.17.20"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",

View file

@ -27,8 +27,6 @@
"intl": "^1.2.5",
"intl-locales-supported": "^1.8.12",
"lodash": "^4.17.20",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"resolve-pathname": "^3.0.0"
},
"engines": {

View file

@ -9,8 +9,7 @@ import chalk from 'chalk';
import path from 'path';
import matter from 'gray-matter';
import {createHash} from 'crypto';
import camelCase from 'lodash.camelcase';
import kebabCase from 'lodash.kebabcase';
import {camelCase, kebabCase, mapValues} from 'lodash';
import escapeStringRegexp from 'escape-string-regexp';
import fs from 'fs-extra';
import {URL} from 'url';
@ -22,7 +21,6 @@ import {
// @ts-expect-error: no typedefs :s
import resolvePathnameUnsafe from 'resolve-pathname';
import {mapValues} from 'lodash';
import areIntlLocalesSupported from 'intl-locales-supported';
const fileHash = new Map();

View file

@ -84,10 +84,6 @@
"joi": "^17.4.0",
"leven": "^3.1.0",
"lodash": "^4.17.20",
"lodash.flatmap": "^4.5.0",
"lodash.has": "^4.5.2",
"lodash.isplainobject": "^4.0.6",
"lodash.isstring": "^4.0.1",
"mini-css-extract-plugin": "^0.8.0",
"module-alias": "^2.2.2",
"nprogress": "^0.2.0",

View file

@ -11,7 +11,7 @@ import chokidar from 'chokidar';
import express from 'express';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
import debounce from 'lodash/debounce';
import {debounce} from 'lodash';
import openBrowser from 'react-dev-utils/openBrowser';
import {prepareUrls} from 'react-dev-utils/WebpackDevServerUtils';
import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware';

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import isPlainObject from 'lodash.isplainobject';
import {isPlainObject} from 'lodash';
import {HtmlTagObject} from '@docusaurus/types';
import htmlTags from 'html-tags';
import voidHtmlTags from 'html-tags/void';

View file

@ -11,9 +11,7 @@ import {
removeSuffix,
simpleHash,
} from '@docusaurus/utils';
import has from 'lodash.has';
import isPlainObject from 'lodash.isplainobject';
import isString from 'lodash.isstring';
import {has, isPlainObject, isString} from 'lodash';
import {stringify} from 'querystring';
import {
ChunkRegistry,

View file

@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import flatMap from 'lodash.flatmap';
import {flatMap} from 'lodash';
import {RouteConfig} from '@docusaurus/types';
// Recursively get the final routes (routes with no subroutes)

View file

@ -15,7 +15,7 @@
"dependencies": {
"file-loader": "^6.2.0",
"loader-utils": "^1.2.3",
"lodash.sortby": "^4.7.0",
"lodash": "^4.17.20",
"node-vibrant": "^3.1.5",
"sharp": "^0.27.1"
},

View file

@ -7,7 +7,7 @@
// @ts-check
const sortBy = require('lodash.sortby');
const {sortBy} = require('lodash');
/**
* toBase64