Skip to content

Commit

Permalink
fix(create): deep merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chnliquan committed Oct 8, 2022
1 parent db104ac commit bd589dd
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/create/src/internal/features/built-in.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
chalk,
deepMerge,
installWithNpmClient,
isFunction,
logger,
} from '@eljs/utils'
import { chalk, installWithNpmClient, isFunction, logger } from '@eljs/utils'
import { existsSync, writeFileSync } from 'fs'
import { join } from 'path'
import prettier from 'prettier'
Expand Down Expand Up @@ -55,7 +49,7 @@ export default (api: Api) => {
async fn(opts: ExtendPackageOpts) {
const pkgJSON = api.service.pkgJSON
const toMerge = (isFunction(opts) ? await opts(pkgJSON) : opts) ?? {}
api.service.pkgJSON = deepMerge(api.service.pkgJSON, toMerge)
api.service.pkgJSON = api.lodash.merge(api.service.pkgJSON, toMerge)
},
})

Expand All @@ -69,7 +63,7 @@ export default (api: Api) => {
if (existsSync(pkgJSONPath)) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const originPkgJSON = require(pkgJSONPath)
pkgJSON = deepMerge(originPkgJSON, pkgJSON)
pkgJSON = api.lodash.merge(originPkgJSON, pkgJSON)
}

if (Object.keys(pkgJSON).length === 0) {
Expand Down

0 comments on commit bd589dd

Please # to comment.