From 32a137a7774f3bba9a2b57f51f50279ed0c61369 Mon Sep 17 00:00:00 2001 From: Robbie Wagner Date: Tue, 16 Jul 2024 07:40:44 -0400 Subject: [PATCH] Remove lodash (#464) --- package.json | 7 +++---- tests/dummy/app/components/chart-highstock-interactive.js | 5 +---- tests/dummy/app/components/chart-line-interactive.js | 5 +---- tests/dummy/app/services/dynamic-chart.js | 5 +---- tests/integration/components/high-charts-test.js | 7 ++----- yarn.lock | 5 ----- 6 files changed, 8 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 53cafa1..6399e09 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,7 @@ "deepmerge": "^4.3.1", "ember-auto-import": "^2.7.2", "ember-cli-babel": "^8.2.0", - "ember-cli-htmlbars": "^6.3.0", - "lodash-es": "^4.17.21", - "webpack": "^5.91.0" + "ember-cli-htmlbars": "^6.3.0" }, "devDependencies": { "@babel/core": "^7.24.4", @@ -94,7 +92,8 @@ "stylelint": "^15.11.0", "stylelint-config-standard": "^34.0.0", "stylelint-prettier": "^4.1.0", - "typescript": "^5.5.3" + "typescript": "^5.5.3", + "webpack": "^5.91.0" }, "peerDependencies": { "ember-source": ">= 3.28.0", diff --git a/tests/dummy/app/components/chart-highstock-interactive.js b/tests/dummy/app/components/chart-highstock-interactive.js index 02cd531..6bed18b 100644 --- a/tests/dummy/app/components/chart-highstock-interactive.js +++ b/tests/dummy/app/components/chart-highstock-interactive.js @@ -3,9 +3,6 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import stockData from '../data/stock'; -import cloneDeep from 'lodash-es/cloneDeep'; - -const clone = window.structuredClone ?? cloneDeep; export default class BarBasic extends Component { @service('dynamic-chart') @@ -20,7 +17,7 @@ export default class BarBasic extends Component { }, }; - chartData = clone(stockData); + chartData = structuredClone(stockData); @action updateSeriesData() { diff --git a/tests/dummy/app/components/chart-line-interactive.js b/tests/dummy/app/components/chart-line-interactive.js index 52ca7f6..f9eb414 100644 --- a/tests/dummy/app/components/chart-line-interactive.js +++ b/tests/dummy/app/components/chart-line-interactive.js @@ -2,9 +2,6 @@ import { inject as service } from '@ember/service'; import Component from '@glimmer/component'; import commitStats from '../data/commit-stats'; import { action } from '@ember/object'; -import cloneDeep from 'lodash-es/cloneDeep'; - -const clone = window.structuredClone ?? cloneDeep; export default class BarBasic extends Component { @service('dynamic-chart') @@ -30,7 +27,7 @@ export default class BarBasic extends Component { }, }; - chartData = clone(commitStats); + chartData = structuredClone(commitStats); @action updateSeriesData() { diff --git a/tests/dummy/app/services/dynamic-chart.js b/tests/dummy/app/services/dynamic-chart.js index b6fbe68..4ba9e98 100644 --- a/tests/dummy/app/services/dynamic-chart.js +++ b/tests/dummy/app/services/dynamic-chart.js @@ -1,7 +1,4 @@ import Service from '@ember/service'; -import cloneDeep from 'lodash-es/cloneDeep'; - -const clone = window.structuredClone ?? cloneDeep; export default class DynamicChart extends Service { getRandomInt(min, max) { @@ -19,7 +16,7 @@ export default class DynamicChart extends Service { } updateSeriesCount(chartData, numSeries) { - let chartDataCopy = clone(chartData); + let chartDataCopy = structuredClone(chartData); return chartDataCopy.slice(0, numSeries); } } diff --git a/tests/integration/components/high-charts-test.js b/tests/integration/components/high-charts-test.js index 4e4b76e..9775178 100644 --- a/tests/integration/components/high-charts-test.js +++ b/tests/integration/components/high-charts-test.js @@ -2,9 +2,6 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, settled, waitFor } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -import cloneDeep from 'lodash-es/cloneDeep'; - -const clone = window.structuredClone ?? cloneDeep; import { lineChartOptions, @@ -67,7 +64,7 @@ module('Integration | Component | High Charts', function (hooks) { .exists({ count: 3 }, 'base series count'); // add a series to chart content - let cityDataCopy = clone(cityData); + let cityDataCopy = structuredClone(cityData); cityDataCopy.push({ name: 'San Francisco', data: [ @@ -98,7 +95,7 @@ module('Integration | Component | High Charts', function (hooks) { .exists({ count: 3 }, 'base series count'); // remove a series from chart content - let cityDataCopy = clone(cityData); + let cityDataCopy = structuredClone(cityData); cityDataCopy = cityDataCopy.slice(0, 2); this.set('cityData', cityDataCopy); diff --git a/yarn.lock b/yarn.lock index d0528a3..69b5b95 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8155,11 +8155,6 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" -lodash-es@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" - integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== - lodash._baseflatten@^3.0.0: version "3.1.4" resolved "https://registry.yarnpkg.com/lodash._baseflatten/-/lodash._baseflatten-3.1.4.tgz#0770ff80131af6e34f3b511796a7ba5214e65ff7"