Skip to content

Commit

Permalink
fix: use lodash merge instead of deepmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Feb 27, 2019
1 parent 571ffcd commit 18ac37b
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion core/docz-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"chalk": "^2.4.2",
"chokidar": "^2.1.2",
"common-tags": "^1.8.0",
"deepmerge": "^3.2.0",
"detect-port": "^1.3.0",
"docz-utils": "^0.13.6",
"dotenv": "^6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion core/docz-core/src/config/babel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { load } from 'load-cfg'
import merge from 'deepmerge'
import { merge } from 'lodash'
import getCacheIdentifier from 'react-dev-utils/getCacheIdentifier'

import { Config, Env } from '../config/argv'
Expand Down
1 change: 0 additions & 1 deletion core/docz-utils/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
declare module 'deepmerge'
declare module 'to-vfile'
declare module 'unified'
declare module 'remark-parse'
Expand Down
1 change: 0 additions & 1 deletion core/docz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@reach/router": "^1.2.1",
"array-sort": "^1.0.0",
"capitalize": "^2.0.0",
"deepmerge": "^3.2.0",
"docz-core": "^0.13.6",
"fast-deep-equal": "^2.0.1",
"lodash": "^4.17.11",
Expand Down
4 changes: 2 additions & 2 deletions core/docz/src/hooks/useConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from 'react'
import merge from 'deepmerge'
import { merge } from 'lodash/fp'

import { doczState, ThemeConfig, Config } from '../state'

Expand All @@ -11,7 +11,7 @@ export interface UseConfigObj extends Config {
export const useConfig = (): UseConfigObj => {
const state = useContext(doczState.context)
const { linkComponent, transform, config, themeConfig = {} } = state
const newConfig = merge(themeConfig, config ? config.themeConfig : {})
const newConfig = merge(config ? config.themeConfig : {}, themeConfig)
const transformed = transform ? transform(newConfig) : newConfig

return {
Expand Down
2 changes: 1 addition & 1 deletion other-packages/load-cfg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@babel/preset-env": "^7.3.4",
"@babel/register": "^7.0.0",
"deepmerge": "^3.2.0",
"lodash": "^4.17.11",
"find-up": "^3.0.0",
"fs-extra": "^7.0.1"
},
Expand Down
4 changes: 2 additions & 2 deletions other-packages/load-cfg/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs-extra'
import * as path from 'path'
import * as findup from 'find-up'
import merge from 'deepmerge'
import { merge } from 'lodash/fp'

export const loadFile = (filepath: string, noCache?: boolean) => {
require('@babel/register')({
Expand Down Expand Up @@ -51,7 +51,7 @@ export function load<C = any>(
const file = filepath ? loadFile(filepath, noCache) : {}
const next = defaultConfig
? deep
? merge(defaultConfig, file)
? merge(file, defaultConfig)
: { ...defaultConfig, ...file }
: file

Expand Down
1 change: 0 additions & 1 deletion other-packages/load-cfg/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare module 'deepmerge'
declare module 'esm'

0 comments on commit 18ac37b

Please sign in to comment.