Skip to content

Commit

Permalink
Merge pull request #15 from hypertrace/lodash-es
Browse files Browse the repository at this point in the history
refactor: use lodash modules
  • Loading branch information
aaron-steinfeld authored Jul 16, 2020
2 parents 6a4df71 + 96fe58e commit 48f3a26
Show file tree
Hide file tree
Showing 30 changed files with 56 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting Started

[![CircleCI](https://circleci.com/gh/hypertrace/hyperdash.svg?style=svg)](https://circleci.com/gh/hypertrace/hyperdash)
[![CircleCI](https://circleci.com/gh/hypertrace/hyperdash.svg?style=shield)](https://circleci.com/gh/hypertrace/hyperdash)
[![codecov](https://codecov.io/gh/hypertrace/hyperdash/branch/master/graph/badge.svg)](https://codecov.io/gh/hypertrace/hyperdash)

## Prerequisites
Expand Down
23 changes: 19 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"ts",
"js"
],
"moduleNameMapper": {
"^lodash-es$": "lodash"
},
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
Expand Down Expand Up @@ -89,7 +92,7 @@
"@rollup/plugin-node-resolve": "^8.1.0",
"@rollup/plugin-typescript": "^5.0.1",
"@types/jest": "^26.0.3",
"@types/lodash": "^4.14.157",
"@types/lodash-es": "^4.17.3",
"@types/node": "^14.0.14",
"commitizen": "^4.1.2",
"core-js": "3.6.5",
Expand All @@ -99,10 +102,11 @@
"jest-config": "^26.1.0",
"jest-html-reporter": "^3.1.3",
"jest-junit": "^11.0.1",
"lodash": "^4.17.15",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"rimraf": "^3.0.2",
"rollup": "^2.19.0",
"rollup": "^2.21.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-typescript2": "^0.27.1",
Expand All @@ -115,7 +119,7 @@
"typescript": "^3.9.6"
},
"dependencies": {
"lodash": "^4.17.15"
"lodash-es": "^4.17.15"
},
"peerDependencies": {
"rxjs": "^6.5.5",
Expand Down
18 changes: 2 additions & 16 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// tslint:disable
import { camelCase } from 'lodash';
import commonjs from 'rollup-plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
Expand All @@ -12,22 +11,9 @@ const libraryName = 'hyperdash';

export default {
input: `src/${libraryName}.ts`,
output: [
{
file: pkg.main,
name: camelCase(libraryName),
format: 'umd',
sourcemap: true,
globals: {
lodash: '_',
rxjs: 'rxjs',
'rxjs/operators': 'rxjs.operators'
}
},
{ file: pkg.module, format: 'es', sourcemap: true }
],
output: [{ file: pkg.module, format: 'es', sourcemap: true }],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: ['lodash', 'rxjs', 'rxjs/operators', 'core-js/es7/reflect'],
external: ['lodash-es', 'rxjs', 'rxjs/operators', 'core-js/es7/reflect'],
watch: {
include: 'src/**'
},
Expand Down
2 changes: 1 addition & 1 deletion src/model/editor/editor-library.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash';
import { isNil } from 'lodash-es';
import { DataSourceManager } from '../../data/data-source/manager/data-source-manager';
import { RendererLibrary } from '../../renderer/registration/renderer-registration';
import { PartialObjectMock } from '../../test/partial-object-mock';
Expand Down
2 changes: 1 addition & 1 deletion src/model/editor/editor-library.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { uniq } from 'lodash';
import { uniq } from 'lodash-es';
import { DataSourceManager } from '../../data/data-source/manager/data-source-manager';
import { RendererLibrary } from '../../renderer/registration/renderer-registration';
import { Theme } from '../../theming/theme';
Expand Down
2 changes: 1 addition & 1 deletion src/model/manager/model-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloneDeepWith, without } from 'lodash';
import { cloneDeepWith, without } from 'lodash-es';
import { Constructable } from '../../util/constructable';
import { Logger } from '../../util/logging/logger';
import { ModelApiBuilder } from '../api/builder/model-api-builder';
Expand Down
2 changes: 1 addition & 1 deletion src/model/property/predefined/array-property-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash';
import { isNil } from 'lodash-es';

export const ARRAY_PROPERTY = Object.freeze({
type: 'array',
Expand Down
2 changes: 1 addition & 1 deletion src/model/property/predefined/model-property-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash';
import { isNil } from 'lodash-es';
import { DeserializationManager } from '../../../persistence/deserialization/deserialization-manager';
import { ModelJson } from '../../../persistence/model-json';
import { Constructable } from '../../../util/constructable';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil } from 'lodash';
import { isNil } from 'lodash-es';
import { ModelPropertyTypeInstance, PropertyValidatorFunction } from '../model-property-type-library';

const typeofValidator = (type: 'string' | 'boolean' | 'number' | 'object'): PropertyValidatorFunction => (
Expand Down
2 changes: 1 addition & 1 deletion src/model/property/validation/model-property-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from 'lodash';
import { isEmpty } from 'lodash-es';
import { Logger } from '../../../util/logging/logger';
import { ModelPropertyMetadata } from '../../registration/model-registration';
import { ModelPropertyTypeLibrary } from '../model-property-type-library';
Expand Down
2 changes: 1 addition & 1 deletion src/model/registration/model-registration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloneDeep, defaults, startCase } from 'lodash';
import { cloneDeep, defaults, startCase } from 'lodash-es';
import { Constructable, ObjectConstructable, UnknownConstructable } from '../../util/constructable';
import { Logger } from '../../util/logging/logger';
import { getReflectedPropertyType } from '../../util/reflection/reflection-utilities';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tslint:disable:completed-docs
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { DeserializationManager } from '../deserialization-manager';
import { ArrayDeserializer } from './array-deserializer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tslint:disable:completed-docs
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { DeserializationManager } from '../deserialization-manager';
import { ObjectDeserializer } from './object-deserializer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { JsonPrimitive } from '../../model-json';
import { DeserializationManager } from '../deserialization-manager';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { DataSourceManager } from '../../../data/data-source/manager/data-source-manager';
import { ModelManager } from '../../../model/manager/model-manager';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PrimitiveDeserializer } from './primitive-deserializer';

describe('Primitive deserializer', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { includes } from 'lodash';
import { includes } from 'lodash-es';
import { JsonPrimitive } from '../../model-json';
import { Deserializer } from '../deserializer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { VariableManager } from '../../../variable/manager/variable-manager';
import { VariableDeserializer } from './variable-deserializer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { PartialObjectMock } from '../../../test/partial-object-mock';
import { SerializationManager } from '../serialization-manager';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tslint:disable:completed-docs
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { PartialObjectMock } from '../../../test/partial-object-mock';
import { SerializationManager } from '../serialization-manager';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { SerializationManager } from '../serialization-manager';
import { Serializer } from '../serializer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { DataSourceManager } from '../../../data/data-source/manager/data-source-manager';
import { ModelManager } from '../../../model/manager/model-manager';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PrimitiveSerializer } from './primitive-serializer';

describe('Primitive serializer', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { includes } from 'lodash';
import { includes } from 'lodash-es';
import { JsonPrimitive } from '../../model-json';
import { Serializer } from '../serializer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapValues } from 'lodash';
import { mapValues } from 'lodash-es';
import { PropertyLocation } from '../../../model/property/property-location';
import { PartialObjectMock } from '../../../test/partial-object-mock';
import { VariableManager } from '../../../variable/manager/variable-manager';
Expand Down
2 changes: 1 addition & 1 deletion src/variable/evaluator/variable-evaluator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { difference, get } from 'lodash';
import { difference, get } from 'lodash-es';
import { ExpressionParser } from '../parser/expression-parser';
import { ParseNode, ParseNodeType } from '../parser/parse-node';
import { ResolveDictionary } from '../variable-dictionary';
Expand Down
2 changes: 1 addition & 1 deletion src/variable/manager/variable-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fromPairs } from 'lodash';
import { fromPairs } from 'lodash-es';
import { ModelChangedEvent } from '../../model/events/model-changed-event';
import { ModelManager } from '../../model/manager/model-manager';
import { PropertyLocation } from '../../model/property/property-location';
Expand Down
2 changes: 1 addition & 1 deletion src/variable/parser/expression-parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { min } from 'lodash';
import { min } from 'lodash-es';
import { ParseNode, ParseNodeType } from './parse-node';

/**
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"module": "es2015",
"module": "esNext",
"target": "es2015",
"lib": ["es2015", "es2016", "es2017", "esnext.array", "dom"],
"strict": true,
"sourceMap": true,
Expand Down

0 comments on commit 48f3a26

Please sign in to comment.