Skip to content

Commit

Permalink
build(deps): use lodash.* deps
Browse files Browse the repository at this point in the history
instead of `lodash/*`
  • Loading branch information
unicornware committed Sep 18, 2021
1 parent e6adbfa commit 4a9dc84
Show file tree
Hide file tree
Showing 26 changed files with 111 additions and 65 deletions.
4 changes: 2 additions & 2 deletions packages/grease/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ import grease from '@flex-development/grease'
import type { IGreaseOptions } from '@flex-development/grease/interfaces'
import log from '@flex-development/grease/utils/log.util'
import ch from 'chalk'
import merge from 'lodash/merge'
import pick from 'lodash/pick'
import merge from 'lodash.merge'
import pick from 'lodash.pick'
import sh from 'shelljs'
import util from 'util'
import { hideBin } from 'yargs/helpers'
Expand Down
8 changes: 8 additions & 0 deletions packages/grease/__mocks__/lodash.join.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @file Node Module Mock - lodash.join
* @module grease/tests/mocks/lodash.join
* @see https://jestjs.io/docs/next/manual-mocks#mocking-node-modules
* @see https://github.com/lodash/lodash
*/

export default jest.fn((...args) => jest.requireActual('lodash.join')(...args))
8 changes: 8 additions & 0 deletions packages/grease/__mocks__/lodash.merge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @file Node Module Mock - lodash.merge
* @module grease/tests/mocks/lodash.merge
* @see https://jestjs.io/docs/next/manual-mocks#mocking-node-modules
* @see https://github.com/lodash/lodash
*/

export default jest.fn((...args) => jest.requireActual('lodash.merge')(...args))
8 changes: 8 additions & 0 deletions packages/grease/__mocks__/lodash.pick.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @file Node Module Mock - lodash.pick
* @module grease/tests/mocks/lodash.pick
* @see https://jestjs.io/docs/next/manual-mocks#mocking-node-modules
* @see https://github.com/lodash/lodash
*/

export default jest.fn((...args) => jest.requireActual('lodash.pick')(...args))
8 changes: 0 additions & 8 deletions packages/grease/__mocks__/lodash/join.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/grease/__mocks__/lodash/merge.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/grease/__mocks__/lodash/pick.ts

This file was deleted.

17 changes: 14 additions & 3 deletions packages/grease/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@
"figures": "3.2.0",
"git-semver-tags": "4.1.1",
"isomorphic-git": "1.9.2",
"lodash": "4.17.21",
"lodash-es": "4.17.21",
"lodash.indexof": "4.0.5",
"lodash.isempty": "4.4.0",
"lodash.isplainobject": "4.0.6",
"lodash.join": "4.0.1",
"lodash.merge": "4.6.2",
"lodash.omit": "4.5.0",
"lodash.pick": "4.4.0",
"reflect-metadata": "0.1.13",
"semver": "7.3.5",
"shell-quote": "1.7.2",
Expand Down Expand Up @@ -93,7 +98,13 @@
"@tests/utils": "link:../../__tests__/utils",
"@types/faker": "5.5.6",
"@types/jest": "27.0.1",
"@types/lodash": "4.14.172",
"@types/lodash.indexof": "4.0.6",
"@types/lodash.isempty": "4.4.6",
"@types/lodash.isplainobject": "4.0.6",
"@types/lodash.join": "4.0.6",
"@types/lodash.merge": "4.6.6",
"@types/lodash.omit": "4.5.6",
"@types/lodash.pick": "4.4.6",
"@types/node": "16.9.2",
"@types/shelljs": "0.8.9",
"@zerollup/ts-transform-paths": "1.7.18",
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/__tests__/main.functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import logger from '@grease/utils/logger.util'
import readPackageFiles from '@grease/utils/read-package-files.util'
import anymatch from 'anymatch'
import { currentBranch } from 'isomorphic-git'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import bump from 'standard-version/lib/lifecycles/bump'
import changelog from 'standard-version/lib/lifecycles/changelog'
import commit from 'standard-version/lib/lifecycles/commit'
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/config/defaults.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DEFAULTS_DTAG from '@flex-development/dtag/config/defaults.config'
import { NotesType } from '@grease/enums/notes-type.enum'
import type { GreaseOptionsDefaults } from '@grease/interfaces'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import DEFAULTS_STANDARD_VERSION from 'standard-version/defaults'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/constraints/is-branch.constraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'class-validator'
import fs from 'fs'
import { listBranches } from 'isomorphic-git'
import merge from 'lodash/merge'
import merge from 'lodash.merge'

/**
* @file Decorator Constraints - IsBranchConstraint
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/constraints/is-path.constraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ValidatorConstraint as Constraint
} from 'class-validator'
import { existsSync } from 'fs'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import { join } from 'path'

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/grease/src/constraints/is-sem-ver.constraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
buildMessage,
ValidatorConstraint as Constraint
} from 'class-validator'
import isPlainObject from 'lodash/isPlainObject'
import merge from 'lodash/merge'
import isPlainObject from 'lodash.isplainobject'
import merge from 'lodash.merge'
import type { CoerceOptions } from 'semver'

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
buildMessage,
ValidatorConstraint as Constraint
} from 'class-validator'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import IsBranchConstraint from './is-branch.constraint'
import IsCommitConstraint from './is-commit.constraint'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DTO from '@grease/tests/fixtures/create-release-dto.fixture'
import join from 'lodash/join'
import pick from 'lodash/pick'
import join from 'lodash.join'
import pick from 'lodash.pick'
import TestSubject from '../create-release.dto'

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/grease/src/dtos/create-release.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import IsSemVer from '@grease/decorators/is-sem-ver.decorator'
import IsTargetBranch from '@grease/decorators/is-target-branch.decorator'
import type { ICreateReleaseDTO } from '@grease/interfaces'
import { IsBoolean, IsOptional, IsString, ValidateIf } from 'class-validator'
import join from 'lodash/join'
import pick from 'lodash/pick'
import join from 'lodash.join'
import pick from 'lodash.pick'
import { quote } from 'shell-quote'

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Exception from '@flex-development/exceptions/exceptions/base.exception'
import { DependencyCommand } from '@grease/enums/dependency-command.enum'
import type { IGreaseOptions } from '@grease/interfaces'
import logger from '@grease/utils/logger.util'
import indexOf from 'lodash/indexOf'
import indexOf from 'lodash.indexof'
import sh from 'shelljs'
import runLifecycleScript from 'standard-version/lib/run-lifecycle-script'
import TestSubject from '../depchecker.lifecycle'
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/lifecycles/notes.lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import changelogVersions from '@grease/utils/changelog-versions.util'
import logger from '@grease/utils/logger.util'
import ch from 'chalk'
import fs from 'fs'
import indexOf from 'lodash/indexOf'
import indexOf from 'lodash.indexof'
import runLifecycleScript from 'standard-version/lib/run-lifecycle-script'

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/grease/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { ObjectPlain } from '@flex-development/tutils'
import anymatch from 'anymatch'
import fs from 'fs'
import { currentBranch } from 'isomorphic-git'
import isEmpty from 'lodash/isEmpty'
import merge from 'lodash/merge'
import isEmpty from 'lodash.isempty'
import merge from 'lodash.merge'
import bump from 'standard-version/lib/lifecycles/bump'
import changelog from 'standard-version/lib/lifecycles/changelog'
import commit from 'standard-version/lib/lifecycles/commit'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ExceptionStatusCode } from '@flex-development/exceptions/enums'
import Exception from '@flex-development/exceptions/exceptions/base.exception'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import latestSemverTag from 'standard-version/lib/latest-semver-tag'
import { resolveUpdaterObjectFromArgument } from 'standard-version/lib/updaters'
import testSubject from '../read-package-files.util'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { classToPlain } from 'class-transformer'
import type { TransformValidationOptions } from 'class-transformer-validator'
import { transformAndValidateSync } from 'class-transformer-validator'
import { IsString } from 'class-validator'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import { mocked } from 'ts-jest/utils'
import testSubject from '../validate-sync.util'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { classToPlain } from 'class-transformer'
import type { TransformValidationOptions } from 'class-transformer-validator'
import { transformAndValidate } from 'class-transformer-validator'
import { IsString } from 'class-validator'
import merge from 'lodash/merge'
import merge from 'lodash.merge'
import { mocked } from 'ts-jest/utils'
import testSubject from '../validate.util'

Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/utils/validate-sync.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
TransformValidationOptions
} from 'class-transformer-validator'
import { transformAndValidateSync } from 'class-transformer-validator'
import merge from 'lodash/merge'
import merge from 'lodash.merge'

/**
* @file Utility - validateSync
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/utils/validate.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
TransformValidationOptions
} from 'class-transformer-validator'
import { transformAndValidate } from 'class-transformer-validator'
import merge from 'lodash/merge'
import merge from 'lodash.merge'

/**
* @file Utility - validate
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.prod.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"packages/grease/node_modules/@flex-development/log/esm/*"
],
"@grease": ["packages/grease/src/index.ts"],
"@grease/*": ["packages/grease/src/*"],
"lodash/*": ["node_modules/lodash-es/*"]
"@grease/*": ["packages/grease/src/*"]
},
"target": "esnext"
},
Expand Down
64 changes: 50 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,13 @@ __metadata:
"@types/faker": 5.5.6
"@types/git-semver-tags": 4.1.1
"@types/jest": 27.0.1
"@types/lodash": 4.14.172
"@types/lodash.indexof": 4.0.6
"@types/lodash.isempty": 4.4.6
"@types/lodash.isplainobject": 4.0.6
"@types/lodash.join": 4.0.6
"@types/lodash.merge": 4.6.6
"@types/lodash.omit": 4.5.6
"@types/lodash.pick": 4.4.6
"@types/node": 16.9.2
"@types/semver": 7.3.8
"@types/shelljs": 0.8.9
Expand All @@ -743,8 +749,13 @@ __metadata:
isomorphic-git: 1.9.2
jest: 27.1.0
jest-mock-console: 1.1.0
lodash: 4.17.21
lodash-es: 4.17.21
lodash.indexof: 4.0.5
lodash.isempty: 4.4.0
lodash.isplainobject: 4.0.6
lodash.join: 4.0.1
lodash.merge: 4.6.2
lodash.omit: 4.5.0
lodash.pick: 4.4.0
reflect-metadata: 0.1.13
semver: 7.3.5
shell-quote: 1.7.2
Expand Down Expand Up @@ -1909,7 +1920,25 @@ __metadata:
languageName: node
linkType: hard

"@types/lodash.isplainobject@npm:latest":
"@types/lodash.indexof@npm:4.0.6":
version: 4.0.6
resolution: "@types/lodash.indexof@npm:4.0.6"
dependencies:
"@types/lodash": "*"
checksum: e2863c61d2f30fd083263a1cd245ff2527c8ec1b81e77cab9bd21c5ea4ed5ef5173d651c86fb2b537c02255c242d7c656a6c275d2061bac21e33d93c694e6699
languageName: node
linkType: hard

"@types/lodash.isempty@npm:4.4.6":
version: 4.4.6
resolution: "@types/lodash.isempty@npm:4.4.6"
dependencies:
"@types/lodash": "*"
checksum: 6364a6821841f7ba57d740f0ab254e15cc07ed46739e5d37f293b5a1203b0e710c463fdc5ec9fd6f0432ba5c5f3e67e0590e2322c8065e28275d6736bf663b0f
languageName: node
linkType: hard

"@types/lodash.isplainobject@npm:4.0.6, @types/lodash.isplainobject@npm:latest":
version: 4.0.6
resolution: "@types/lodash.isplainobject@npm:4.0.6"
dependencies:
Expand Down Expand Up @@ -1954,7 +1983,7 @@ __metadata:
languageName: node
linkType: hard

"@types/lodash@npm:*, @types/lodash@npm:4.14.172":
"@types/lodash@npm:*":
version: 4.14.172
resolution: "@types/lodash@npm:4.14.172"
checksum: 5fc51ea40d7e455bd1c760bcc60c9e81f82d85988666d4d4969bd8311367c63bbf1fe2be48755ba87836710e45fff94014ec164ebe6ccaa72815014981152434
Expand Down Expand Up @@ -7429,13 +7458,6 @@ fsevents@^2.3.2:
languageName: node
linkType: hard

"lodash-es@npm:4.17.21":
version: 4.17.21
resolution: "lodash-es@npm:4.17.21"
checksum: 05cbffad6e2adbb331a4e16fbd826e7faee403a1a04873b82b42c0f22090f280839f85b95393f487c1303c8a3d2a010048bf06151a6cbe03eee4d388fb0a12d2
languageName: node
linkType: hard

"lodash.chunk@npm:^4.2.0":
version: 4.2.0
resolution: "lodash.chunk@npm:4.2.0"
Expand Down Expand Up @@ -7464,13 +7486,27 @@ fsevents@^2.3.2:
languageName: node
linkType: hard

"lodash.indexof@npm:4.0.5":
version: 4.0.5
resolution: "lodash.indexof@npm:4.0.5"
checksum: 4f3ead786c2941f18f1ef250459bcc6182ac00f04e76a2b94d3933349c879cd4b79444d59b0de835ad93d7b01626c1bc8ee55d7776879f099c0617d896a29f28
languageName: node
linkType: hard

"lodash.isboolean@npm:^3.0.3":
version: 3.0.3
resolution: "lodash.isboolean@npm:3.0.3"
checksum: b70068b4a8b8837912b54052557b21fc4774174e3512ed3c5b94621e5aff5eb6c68089d0a386b7e801d679cd105d2e35417978a5e99071750aa2ed90bffd0250
languageName: node
linkType: hard

"lodash.isempty@npm:4.4.0":
version: 4.4.0
resolution: "lodash.isempty@npm:4.4.0"
checksum: a8118f23f7ed72a1dbd176bf27f297d1e71aa1926288449cb8f7cef99ba1bc7527eab52fe7899ab080fa1dc150aba6e4a6367bf49fa4e0b78da1ecc095f8d8c5
languageName: node
linkType: hard

"lodash.isinteger@npm:^4.0.4":
version: 4.0.4
resolution: "lodash.isinteger@npm:4.0.4"
Expand All @@ -7492,7 +7528,7 @@ fsevents@^2.3.2:
languageName: node
linkType: hard

"lodash.isplainobject@npm:^4.0.6, lodash.isplainobject@npm:latest":
"lodash.isplainobject@npm:4.0.6, lodash.isplainobject@npm:^4.0.6, lodash.isplainobject@npm:latest":
version: 4.0.6
resolution: "lodash.isplainobject@npm:4.0.6"
checksum: 29c6351f281e0d9a1d58f1a4c8f4400924b4c79f18dfc4613624d7d54784df07efaff97c1ff2659f3e085ecf4fff493300adc4837553104cef2634110b0d5337
Expand Down Expand Up @@ -7562,7 +7598,7 @@ fsevents@^2.3.2:
languageName: node
linkType: hard

"lodash@npm:4.17.21, lodash@npm:4.x, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.7.0":
"lodash@npm:4.x, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.7.0":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7
Expand Down

0 comments on commit 4a9dc84

Please sign in to comment.