Skip to content

Commit

Permalink
refactor(exoflex): import modular lodash package instead of whole lod…
Browse files Browse the repository at this point in the history
…ash package (#584)
  • Loading branch information
darcien authored Dec 15, 2020
1 parent f4b1720 commit ba0463a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
3 changes: 0 additions & 3 deletions packages/exoflex/example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ let extraNodeModules = {};
'react-native-svg',
'expo-font',
'@babel/runtime',
// We probably shouldn't use the entire lodash package here.
// TODO: Remove direct import from lodash in exoflex.
'lodash',
...dependencies,
].forEach((dep) => {
extraNodeModules[dep] = path.resolve(__dirname, 'node_modules', dep);
Expand Down
2 changes: 2 additions & 0 deletions packages/exoflex/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"@types/react-native": "0.63.2",
"babel-plugin-module-resolver": "4.0.0",
"babel-preset-expo": "8.3.0",
"lodash.clamp": "4.0.3",
"lodash.mergewith": "4.6.2",
"lodash.tonumber": "4.0.3",
"react-native-animation-hooks": "1.0.1",
"react-native-calendars": "https://github.com/oshimayoan/react-native-calendars/archive/oshimayoan-0.0.3.tar.gz",
"react-native-collapsible": "1.5.3",
Expand Down
10 changes: 10 additions & 0 deletions packages/exoflex/example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7499,6 +7499,11 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=

[email protected]:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash.clamp/-/lodash.clamp-4.0.3.tgz#5c24bedeeeef0753560dc2b4cb4671f90a6ddfaa"
integrity sha1-XCS+3u7vB1NWDcK0y0Zx+Qpt36o=

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
Expand Down Expand Up @@ -7559,6 +7564,11 @@ lodash.throttle@^4.1.1:
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=

[email protected]:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash.tonumber/-/lodash.tonumber-4.0.3.tgz#0b96b31b35672793eb7f5a63ee791f1b9e9025d9"
integrity sha1-C5azGzVnJ5Prf1pj7nkfG56QJdk=

lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
Expand Down
6 changes: 5 additions & 1 deletion packages/exoflex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"dependencies": {
"@react-native-community/datetimepicker": "2.1.0",
"color": "^3.1.2",
"lodash.mergewith": "^4.6.2",
"lodash.clamp": "4.0.3",
"lodash.mergewith": "4.6.2",
"lodash.tonumber": "4.0.3",
"react-native-animation-hooks": "^1.0.1",
"react-native-calendars": "https://github.com/oshimayoan/react-native-calendars/archive/oshimayoan-0.0.3.tar.gz",
"react-native-collapsible": "^1.5.1",
Expand All @@ -47,7 +49,9 @@
"@types/color": "3.0.1",
"@types/jest": "26.0.9",
"@types/jest-in-case": "1.0.1",
"@types/lodash.clamp": "4.0.6",
"@types/lodash.mergewith": "4.6.6",
"@types/lodash.tonumber": "4.0.6",
"@types/react": "16.9.53",
"@types/react-native": "0.60.4",
"@types/react-native-calendars": "1.20.8",
Expand Down
3 changes: 2 additions & 1 deletion packages/exoflex/src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
AccessibilityProps,
StyleSheet,
} from 'react-native';
import { clamp, toNumber } from 'lodash';
import clamp from 'lodash.clamp';
import toNumber from 'lodash.tonumber';

import useTheme from '../helpers/useTheme';

Expand Down
26 changes: 25 additions & 1 deletion packages/exoflex/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1746,13 +1746,27 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==

"@types/[email protected]":
version "4.0.6"
resolved "https://registry.yarnpkg.com/@types/lodash.clamp/-/lodash.clamp-4.0.6.tgz#ca51ac61e11c6c6109638f44179abb97031619cb"
integrity sha512-+Rn39PbxYSbFFVXGEpw5t7EM8clP4P3d5rtbBFJYZUsgyWO1S0EYiNf+vKc2dRUy5eSI+oAVVlpgMF0vJcMUtA==
dependencies:
"@types/lodash" "*"

"@types/[email protected]":
version "4.6.6"
resolved "https://registry.yarnpkg.com/@types/lodash.mergewith/-/lodash.mergewith-4.6.6.tgz#c4698f5b214a433ff35cb2c75ee6ec7f99d79f10"
integrity sha512-RY/8IaVENjG19rxTZu9Nukqh0W2UrYgmBj5sdns4hWRZaV8PqR7wIKHFKzvOTjo4zVRV7sVI+yFhAJql12Kfqg==
dependencies:
"@types/lodash" "*"

"@types/[email protected]":
version "4.0.6"
resolved "https://registry.yarnpkg.com/@types/lodash.tonumber/-/lodash.tonumber-4.0.6.tgz#9f0f4b851ac037ecfdfda8acad5cfbcca832bf96"
integrity sha512-vshCv7o3sGBehvf1BWNA/QlnPw3cI51HLLKQZinKGn8YrHYq9Pp4nbqXBBqC1Wh1IKANQEQyDQKRtB7YSwqdKA==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.144"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.144.tgz#12e57fc99064bce45e5ab3c8bc4783feb75eab8e"
Expand Down Expand Up @@ -5940,6 +5954,11 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=

[email protected]:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash.clamp/-/lodash.clamp-4.0.3.tgz#5c24bedeeeef0753560dc2b4cb4671f90a6ddfaa"
integrity sha1-XCS+3u7vB1NWDcK0y0Zx+Qpt36o=

lodash.find@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1"
Expand All @@ -5965,7 +5984,7 @@ lodash.isstring@^4.0.1:
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=

lodash.mergewith@^4.6.2:
[email protected]:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
Expand Down Expand Up @@ -6010,6 +6029,11 @@ lodash.throttle@^4.1.1:
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=

[email protected]:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash.tonumber/-/lodash.tonumber-4.0.3.tgz#0b96b31b35672793eb7f5a63ee791f1b9e9025d9"
integrity sha1-C5azGzVnJ5Prf1pj7nkfG56QJdk=

[email protected]:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
Expand Down

0 comments on commit ba0463a

Please sign in to comment.