Skip to content

Commit

Permalink
fix: remove duplicated lodash dependencies and optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Mar 8, 2021
1 parent 9a6d6a9 commit cd13908
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 185 deletions.
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,7 @@
"@types/fs-extra": "^9.0.6",
"@types/jest": "^26.0.20",
"@types/loader-utils": "^1.1.3",
"@types/lodash.camelcase": "^4.3.6",
"@types/lodash.flatmap": "^4.5.6",
"@types/lodash.groupby": "^4.6.6",
"@types/lodash.has": "^4.5.6",
"@types/lodash.isplainobject": "^4.0.6",
"@types/lodash.isstring": "^4.0.6",
"@types/lodash.kebabcase": "^4.1.6",
"@types/lodash.pick": "^4.4.6",
"@types/lodash.pickby": "^4.6.6",
"@types/lodash.sortby": "^4.6.6",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.22",
"@types/prismjs": "^1.16.2",
"@types/prompts": "^2.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-init/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-init/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-content-docs/src/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 & {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-search-algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions packages/docusaurus-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 1 addition & 3 deletions packages/docusaurus-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
Expand Down
4 changes: 0 additions & 4 deletions packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/server/html-tags/htmlTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 1 addition & 3 deletions packages/docusaurus/src/server/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/lqip-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/lqip-loader/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// @ts-check

const sortBy = require('lodash.sortby');
const {sortBy} = require('lodash');

/**
* toBase64
Expand Down
Loading

0 comments on commit cd13908

Please sign in to comment.