@@ -146,7 +158,8 @@ function TraitTile({
aria-controls="long-menu"
aria-haspopup="true"
onClick={handleClick}
- size="large">
+ size="large"
+ >
@@ -159,9 +172,7 @@ function TraitTile({
transitionDuration={{ enter: 225, exit: 195 }}
>
diff --git a/packages/multi-trait-rubric/controller/package.json b/packages/multi-trait-rubric/controller/package.json
index 081a2cdd25..639fa50968 100644
--- a/packages/multi-trait-rubric/controller/package.json
+++ b/packages/multi-trait-rubric/controller/package.json
@@ -9,6 +9,6 @@
"license": "ISC",
"dependencies": {
"debug": "^4.1.1",
- "lodash": "^4.17.15"
+ "lodash-es": "^4.17.23"
}
}
diff --git a/packages/multiple-choice/configure/package.json b/packages/multiple-choice/configure/package.json
index d277d7c4de..e4762ae4c1 100644
--- a/packages/multiple-choice/configure/package.json
+++ b/packages/multiple-choice/configure/package.json
@@ -14,7 +14,7 @@
"@pie-lib/editable-html-tip-tap": "1.1.1-next.1",
"@pie-lib/render-ui": "5.1.1-next.0",
"debug": "^4.1.1",
- "lodash": "^4.17.23",
+ "lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0"
diff --git a/packages/multiple-choice/configure/src/index.js b/packages/multiple-choice/configure/src/index.js
index 3a7fa31b58..0db043f231 100644
--- a/packages/multiple-choice/configure/src/index.js
+++ b/packages/multiple-choice/configure/src/index.js
@@ -11,7 +11,7 @@ import {
import Main from './main';
import { choiceUtils as utils } from '@pie-lib/config-ui';
-import defaults from 'lodash/defaults';
+import { defaults } from 'lodash-es';
import sensibleDefaults from './defaults';
@@ -179,7 +179,7 @@ export default class MultipleChoice extends HTMLElement {
log('_render - Model:', this._model ? 'present' : 'missing');
log('_render - Configuration:', this._configuration ? 'present' : 'missing');
log('_render - Root exists:', !!this._root);
-
+
try {
let element = React.createElement(Main, {
model: this._model,
@@ -200,19 +200,19 @@ export default class MultipleChoice extends HTMLElement {
if (!this._root) {
console.log('🔧 [multiple-choice-configure] _render - Creating React container');
log('_render - Creating React container');
-
+
// Create a container div for React to render into
this._reactContainer = document.createElement('div');
this._reactContainer.className = 'pie-configure-wrapper';
this.appendChild(this._reactContainer);
-
+
console.log('🔧 [multiple-choice-configure] _render - Creating new React root');
log('_render - Creating new React root');
this._root = createRoot(this._reactContainer);
console.log('✅ [multiple-choice-configure] _render - React root created successfully');
log('_render - React root created successfully');
}
-
+
console.log('🔧 [multiple-choice-configure] _render - Calling root.render()');
log('_render - Calling root.render()');
this._root.render(element);
diff --git a/packages/multiple-choice/configure/src/main.jsx b/packages/multiple-choice/configure/src/main.jsx
index c991927fdc..7c9b684d5d 100644
--- a/packages/multiple-choice/configure/src/main.jsx
+++ b/packages/multiple-choice/configure/src/main.jsx
@@ -16,7 +16,7 @@ import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import Info from '@mui/icons-material/Info';
-import merge from 'lodash/merge';
+import { merge } from 'lodash-es';
import { generateValidationMessage } from './utils';
const { Panel, toggle, radio, dropdown } = settings;
diff --git a/packages/multiple-choice/controller/package.json b/packages/multiple-choice/controller/package.json
index d1de86d943..f36e7dca78 100644
--- a/packages/multiple-choice/controller/package.json
+++ b/packages/multiple-choice/controller/package.json
@@ -10,6 +10,6 @@
"dependencies": {
"@pie-lib/controller-utils": "1.1.1-next.0",
"debug": "^4.1.1",
- "lodash": "^4.17.23"
+ "lodash-es": "^4.17.23"
}
}
diff --git a/packages/multiple-choice/controller/src/index.js b/packages/multiple-choice/controller/src/index.js
index 3818b41d0b..5dccd86328 100644
--- a/packages/multiple-choice/controller/src/index.js
+++ b/packages/multiple-choice/controller/src/index.js
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
-import isEmpty from 'lodash/isEmpty';
+import { isEmpty } from 'lodash-es';
import { isResponseCorrect } from './utils';
import defaults from './defaults';
import { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';
diff --git a/packages/multiple-choice/controller/src/utils.js b/packages/multiple-choice/controller/src/utils.js
index c99cdce29d..13a0937833 100644
--- a/packages/multiple-choice/controller/src/utils.js
+++ b/packages/multiple-choice/controller/src/utils.js
@@ -1,4 +1,4 @@
-import isEqual from 'lodash/isEqual';
+import { isEqual } from 'lodash-es';
export const getCorrectResponse = (choices) =>
choices
diff --git a/packages/multiple-choice/package.json b/packages/multiple-choice/package.json
index 38f5cc8efb..f8d9b8f5d7 100644
--- a/packages/multiple-choice/package.json
+++ b/packages/multiple-choice/package.json
@@ -17,7 +17,7 @@
"@pie-lib/translator": "3.1.1-next.0",
"classnames": "^2.2.5",
"debug": "^4.1.1",
- "lodash": "^4.17.23",
+ "lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.3.1",
"react-dom": "18.3.1",
diff --git a/packages/multiple-choice/src/__tests__/index-test.jsx b/packages/multiple-choice/src/__tests__/index-test.jsx
index ffade9dbc0..4d33b7cbfa 100644
--- a/packages/multiple-choice/src/__tests__/index-test.jsx
+++ b/packages/multiple-choice/src/__tests__/index-test.jsx
@@ -7,7 +7,9 @@ import { isComplete } from '../index';
jest.useFakeTimers();
jest.mock('@pie-lib/math-rendering', () => ({ renderMath: jest.fn() }));
-jest.mock('lodash/debounce', () => jest.fn((fn) => fn));
+jest.mock('lodash-es', () => ({
+ debounce: jest.fn((fn) => fn),
+}));
// Mock the render-ui PreviewLayout
jest.mock('@pie-lib/render-ui', () => ({
diff --git a/packages/multiple-choice/src/index.js b/packages/multiple-choice/src/index.js
index 282f35ac0c..079bc8e2a7 100644
--- a/packages/multiple-choice/src/index.js
+++ b/packages/multiple-choice/src/index.js
@@ -1,7 +1,7 @@
import Main from './main';
import React from 'react';
import { createRoot } from 'react-dom/client';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash-es';
import debug from 'debug';
import { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';
import { renderMath } from '@pie-lib/math-rendering';
diff --git a/packages/multiple-choice/src/print.js b/packages/multiple-choice/src/print.js
index 0ee37bcd26..56158a4fd9 100644
--- a/packages/multiple-choice/src/print.js
+++ b/packages/multiple-choice/src/print.js
@@ -1,7 +1,6 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
-import debounce from 'lodash/debounce';
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep, debounce } from 'lodash-es';
import Main from './main';
import { renderMath } from '@pie-lib/math-rendering';
import debug from 'debug';
diff --git a/packages/number-line/configure/package.json b/packages/number-line/configure/package.json
index 71381e088f..8f6bee89bf 100644
--- a/packages/number-line/configure/package.json
+++ b/packages/number-line/configure/package.json
@@ -13,7 +13,7 @@
"@pie-lib/config-ui": "12.1.1-next.1",
"@pie-lib/editable-html-tip-tap": "1.1.1-next.1",
"@pie-lib/render-ui": "5.1.1-next.0",
- "lodash": "^4.17.15",
+ "lodash-es": "^4.17.23",
"react": "18.2.0",
"react-dom": "18.2.0"
}
diff --git a/packages/number-line/configure/src/index.js b/packages/number-line/configure/src/index.js
index 11fdd18397..5c73467183 100644
--- a/packages/number-line/configure/src/index.js
+++ b/packages/number-line/configure/src/index.js
@@ -10,7 +10,7 @@ import {
} from '@pie-framework/pie-configure-events';
import * as defaults from './defaults';
import * as math from 'mathjs';
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep } from 'lodash-es';
// this function is duplicated in controller; at some point, use the same shared function
const updateTicks = (model) => {
diff --git a/packages/number-line/configure/src/main.jsx b/packages/number-line/configure/src/main.jsx
index ece4325ba9..5e82377a3d 100644
--- a/packages/number-line/configure/src/main.jsx
+++ b/packages/number-line/configure/src/main.jsx
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import Domain from './domain';
import Arrows from './arrows';
import PointConfig from './point-config';
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep } from 'lodash-es';
import { styled } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Info from '@mui/icons-material/Info';
diff --git a/packages/number-line/controller/package.json b/packages/number-line/controller/package.json
index 20c0b6e575..30e6d3c0e5 100644
--- a/packages/number-line/controller/package.json
+++ b/packages/number-line/controller/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@pie-lib/controller-utils": "1.1.1-next.0",
"@pie-lib/feedback": "1.1.1-next.0",
- "lodash": "^4.17.15",
+ "lodash-es": "^4.17.23",
"mathjs": "^7.5.1"
},
"author": "",
diff --git a/packages/number-line/controller/src/__tests__/index.test.js b/packages/number-line/controller/src/__tests__/index.test.js
index 9e6e94ebd9..fe4811a50a 100644
--- a/packages/number-line/controller/src/__tests__/index.test.js
+++ b/packages/number-line/controller/src/__tests__/index.test.js
@@ -1,4 +1,4 @@
-import _ from 'lodash';
+import { isFunction, merge } from 'lodash-es';
import { defaults } from '@pie-lib/feedback';
import * as controller from '../index';
import { normalize } from '../index';
@@ -272,14 +272,14 @@ describe('controller', () => {
describe('model', () => {
const assertModel = (msg, question, session, env, expected) => {
question = mkQuestion(question);
- session = _.merge(session, {});
- env = _.merge(env, {});
+ session = merge(session, {});
+ env = merge(env, {});
it(msg, () => {
return controller
.model(question, session, env)
.then((o) => {
- if (_.isFunction(expected)) {
+ if (isFunction(expected)) {
expected(o);
} else {
expect(o).toMatchObject(expected);
diff --git a/packages/number-line/controller/src/index.js b/packages/number-line/controller/src/index.js
index dac0f4c70e..24244aac44 100644
--- a/packages/number-line/controller/src/index.js
+++ b/packages/number-line/controller/src/index.js
@@ -1,9 +1,4 @@
-import cloneDeep from 'lodash/cloneDeep';
-import find from 'lodash/find';
-import isEmpty from 'lodash/isEmpty';
-import isEqualWith from 'lodash/isEqualWith';
-import merge from 'lodash/merge';
-import omitBy from 'lodash/omitBy';
+import { cloneDeep, find, isEmpty, isEqualWith, merge, omitBy } from 'lodash-es';
import { getFeedbackForCorrectness } from '@pie-lib/feedback';
import { partialScoring } from '@pie-lib/controller-utils';
import * as math from 'mathjs';
diff --git a/packages/number-line/controller/src/tickUtils.js b/packages/number-line/controller/src/tickUtils.js
index 7406c5ccc2..f796c1ce9f 100644
--- a/packages/number-line/controller/src/tickUtils.js
+++ b/packages/number-line/controller/src/tickUtils.js
@@ -1,7 +1,5 @@
import * as math from 'mathjs';
-import uniqWith from 'lodash/uniqWith';
-import isObject from 'lodash/isObject';
-import isNumber from 'lodash/isNumber';
+import { isNumber, isObject, uniqWith } from 'lodash-es';
// All these functions are duplicated in src/number-line/graph/tick-utils
diff --git a/packages/number-line/package.json b/packages/number-line/package.json
index 66e36e14f9..3f9cb2400f 100644
--- a/packages/number-line/package.json
+++ b/packages/number-line/package.json
@@ -20,7 +20,7 @@
"classnames": "^2.2.5",
"d3-scale": "^4.0.2",
"d3-selection": "^3.0.0",
- "lodash": "^4.17.10",
+ "lodash-es": "^4.17.23",
"mathjs": "^7.5.1",
"react": "18.3.1",
"react-dom": "18.3.1",
diff --git a/packages/number-line/src/index.js b/packages/number-line/src/index.js
index 3af30f9ba3..df0d70d731 100644
--- a/packages/number-line/src/index.js
+++ b/packages/number-line/src/index.js
@@ -9,7 +9,7 @@ import NumberLineComponent from './number-line';
import React from 'react';
import { createRoot } from 'react-dom/client';
import RootComponent from './number-line';
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep } from 'lodash-es';
import { renderMath } from '@pie-lib/math-rendering';
//Expose some additional modules for configuration
diff --git a/packages/number-line/src/number-line/__tests__/index.test.js b/packages/number-line/src/number-line/__tests__/index.test.js
index d517a4c75e..c15abf51f3 100644
--- a/packages/number-line/src/number-line/__tests__/index.test.js
+++ b/packages/number-line/src/number-line/__tests__/index.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import _ from 'lodash';
+import { merge } from 'lodash-es';
import { render } from '@testing-library/react';
import { NumberLine, Graph } from '../index';
@@ -23,7 +23,7 @@ describe('NumberLine', () => {
onAddElement,
};
- props = _.merge(defaults, props);
+ props = merge(defaults, props);
return render(
);
};
diff --git a/packages/number-line/src/number-line/graph/__tests__/ticks-utils.test.js b/packages/number-line/src/number-line/graph/__tests__/ticks-utils.test.js
index 6c3a212319..e0c7497a62 100644
--- a/packages/number-line/src/number-line/graph/__tests__/ticks-utils.test.js
+++ b/packages/number-line/src/number-line/graph/__tests__/ticks-utils.test.js
@@ -1,7 +1,7 @@
import * as mod from '../tick-utils';
import * as math from 'mathjs';
import { AssertionError } from 'assert';
-import isObject from 'lodash/isObject';
+import { isObject } from 'lodash-es';
const domain = (min, max) => ({ min, max });
const ticks = (minor, major) => ({ minor, major });
diff --git a/packages/number-line/src/number-line/graph/elements/__tests__/line.test.jsx b/packages/number-line/src/number-line/graph/elements/__tests__/line.test.jsx
index c8832e7ac3..13770911f2 100644
--- a/packages/number-line/src/number-line/graph/elements/__tests__/line.test.jsx
+++ b/packages/number-line/src/number-line/graph/elements/__tests__/line.test.jsx
@@ -1,19 +1,20 @@
import React from 'react';
import { render } from '@testing-library/react';
-import _ from 'lodash';
+import { merge } from 'lodash-es';
import { stubContext } from './utils';
import { Line } from '../line';
// Mock Draggable to avoid dnd-kit dependencies
jest.mock('../../../../draggable', () => ({
- Draggable: ({ children }) => children({
- setNodeRef: jest.fn(),
- attributes: {},
- listeners: {},
- translateX: 0,
- isDragging: false,
- onMouseDown: jest.fn()
- }),
+ Draggable: ({ children }) =>
+ children({
+ setNodeRef: jest.fn(),
+ attributes: {},
+ listeners: {},
+ translateX: 0,
+ isDragging: false,
+ onMouseDown: jest.fn(),
+ }),
}));
// Mock Point component
@@ -50,7 +51,7 @@ describe('line', () => {
onDragStop,
};
- props = _.merge(defaults, props);
+ props = merge(defaults, props);
// Create a wrapper component that provides context
const LineWrapper = () => {
diff --git a/packages/number-line/src/number-line/graph/elements/__tests__/point.test.jsx b/packages/number-line/src/number-line/graph/elements/__tests__/point.test.jsx
index f7ca32fe67..9caec1ef7c 100644
--- a/packages/number-line/src/number-line/graph/elements/__tests__/point.test.jsx
+++ b/packages/number-line/src/number-line/graph/elements/__tests__/point.test.jsx
@@ -1,19 +1,20 @@
import React from 'react';
import { render } from '@testing-library/react';
-import _ from 'lodash';
+import { merge } from 'lodash-es';
import { stubContext } from './utils';
import { Point } from '../point';
// Mock Draggable to avoid dnd-kit dependencies
jest.mock('../../../../draggable', () => ({
- Draggable: ({ children }) => children({
- setNodeRef: jest.fn(),
- attributes: {},
- listeners: {},
- translateX: 0,
- isDragging: false,
- onMouseDown: jest.fn()
- }),
+ Draggable: ({ children }) =>
+ children({
+ setNodeRef: jest.fn(),
+ attributes: {},
+ listeners: {},
+ translateX: 0,
+ isDragging: false,
+ onMouseDown: jest.fn(),
+ }),
}));
describe('point', () => {
@@ -43,7 +44,7 @@ describe('point', () => {
onDrag,
};
- props = _.merge(defaults, props);
+ props = merge(defaults, props);
// Create a wrapper component that provides context
const PointWrapper = () => {
diff --git a/packages/number-line/src/number-line/graph/elements/__tests__/ray.test.jsx b/packages/number-line/src/number-line/graph/elements/__tests__/ray.test.jsx
index bb5c2caaca..26bff3391b 100644
--- a/packages/number-line/src/number-line/graph/elements/__tests__/ray.test.jsx
+++ b/packages/number-line/src/number-line/graph/elements/__tests__/ray.test.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import _ from 'lodash';
+import { merge } from 'lodash-es';
import { stubContext } from './utils';
import { Ray } from '../ray';
@@ -28,7 +28,7 @@ describe('ray', () => {
onToggleSelect: onToggleSelect,
};
- props = _.merge(defaults, props);
+ props = merge(defaults, props);
// Create a wrapper component that provides context
const RayWrapper = () => {
@@ -108,7 +108,7 @@ describe('ray', () => {
onToggleSelect: onToggleSelect,
};
- props = _.merge(defaults, props);
+ props = merge(defaults, props);
const instance = new Ray(props);
instance.context = stubContext;
instance.setState = jest.fn((state) => {
diff --git a/packages/number-line/src/number-line/graph/elements/line.jsx b/packages/number-line/src/number-line/graph/elements/line.jsx
index 11bb2180bc..dd2ffd09f6 100644
--- a/packages/number-line/src/number-line/graph/elements/line.jsx
+++ b/packages/number-line/src/number-line/graph/elements/line.jsx
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
-import isEqual from 'lodash/isEqual';
-import isNumber from 'lodash/isNumber';
+import { isEqual, isNumber } from 'lodash-es';
import { color } from '@pie-lib/render-ui';
import { Draggable } from '../../../draggable';
@@ -116,16 +115,7 @@ export class Line extends React.Component {
}
render() {
- const {
- interval,
- empty,
- position,
- domain,
- y,
- selected,
- disabled,
- correct,
- } = this.props;
+ const { interval, empty, position, domain, y, selected, disabled, correct } = this.props;
const { xScale } = this.context;
@@ -196,14 +186,7 @@ export class Line extends React.Component {
onMouseDown={onMouseDown}
onDragEnd={onLineDragStop}
>
- {({
- setNodeRef,
- attributes,
- listeners,
- translateX,
- isDragging,
- onMouseDown: handleMouseDown,
- }) => (
+ {({ setNodeRef, attributes, listeners, translateX, isDragging, onMouseDown: handleMouseDown }) => (
({
'& line': {
diff --git a/packages/number-line/src/number-line/graph/tick-utils.js b/packages/number-line/src/number-line/graph/tick-utils.js
index 2db1c50732..9f9c082185 100644
--- a/packages/number-line/src/number-line/graph/tick-utils.js
+++ b/packages/number-line/src/number-line/graph/tick-utils.js
@@ -1,7 +1,5 @@
import * as math from 'mathjs';
-import uniqWith from 'lodash/uniqWith';
-import isObject from 'lodash/isObject';
-import isNumber from 'lodash/isNumber';
+import { isNumber, isObject, uniqWith } from 'lodash-es';
// All these functions are duplicated in controller/src/tickUtils
diff --git a/packages/number-line/src/number-line/index.jsx b/packages/number-line/src/number-line/index.jsx
index c7c96f00d5..fe264a7d85 100644
--- a/packages/number-line/src/number-line/index.jsx
+++ b/packages/number-line/src/number-line/index.jsx
@@ -1,9 +1,6 @@
import React from 'react';
import Toggle from '@pie-lib/correct-answer-toggle';
-import cloneDeep from 'lodash/cloneDeep';
-import isArray from 'lodash/isArray';
-import isNumber from 'lodash/isNumber';
-import isEqual from 'lodash/isEqual';
+import { cloneDeep, isArray, isEqual, isNumber } from 'lodash-es';
import Translator from '@pie-lib/translator';
import { Collapsible, color, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';
import { styled } from '@mui/material/styles';
diff --git a/packages/passage/configure/package.json b/packages/passage/configure/package.json
index 827212ab3d..132dd90d02 100644
--- a/packages/passage/configure/package.json
+++ b/packages/passage/configure/package.json
@@ -15,7 +15,7 @@
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "12.1.1-next.1",
"@pie-lib/editable-html-tip-tap": "1.1.1-next.1",
- "lodash": "^4.17.23",
+ "lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0"
diff --git a/packages/passage/controller/package.json b/packages/passage/controller/package.json
index 8874e03ed2..775dff9d8d 100644
--- a/packages/passage/controller/package.json
+++ b/packages/passage/controller/package.json
@@ -8,6 +8,6 @@
"author": "",
"license": "ISC",
"dependencies": {
- "lodash": "^4.17.15"
+ "lodash-es": "^4.17.23"
}
}
diff --git a/packages/passage/controller/src/index.js b/packages/passage/controller/src/index.js
index a6995b597a..cfb85aa0e1 100644
--- a/packages/passage/controller/src/index.js
+++ b/packages/passage/controller/src/index.js
@@ -1,4 +1,4 @@
-import isEmpty from 'lodash/isEmpty';
+import { isEmpty } from 'lodash-es';
import defaults from './defaults';
diff --git a/packages/passage/src/print.js b/packages/passage/src/print.js
index cc5078a9fc..c69cf23981 100644
--- a/packages/passage/src/print.js
+++ b/packages/passage/src/print.js
@@ -1,6 +1,6 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash-es';
import debug from 'debug';
import StimulusTabs from './stimulus-tabs';
diff --git a/packages/pie-models/package.json b/packages/pie-models/package.json
index 1a8d34fe97..c3bd64a7f9 100644
--- a/packages/pie-models/package.json
+++ b/packages/pie-models/package.json
@@ -22,7 +22,7 @@
"devDependencies": {
"@types/command-line-args": "^5.0.0",
"@types/fs-extra": "^5.0.4",
- "@types/lodash": "^4.14.119",
+ "@types/lodash-es": "^4.17.12",
"@types/node": "^10.12.18",
"change-case": "^3.1.0",
"command-line-args": "^5.0.2",
@@ -30,7 +30,7 @@
"fs-extra": "^7.0.1",
"json-schema-deref-sync": "^0.7.0",
"json-schema-to-markdown": "^1.0.3",
- "lodash": "^4.17.15",
+ "lodash-es": "^4.17.23",
"ts-node": "^7.0.1",
"typescript": "^3.2.2",
"typescript-json-schema": "^0.34.0",
diff --git a/packages/placement-ordering/configure/package.json b/packages/placement-ordering/configure/package.json
index d8a9ffdc81..7307bfa394 100644
--- a/packages/placement-ordering/configure/package.json
+++ b/packages/placement-ordering/configure/package.json
@@ -16,7 +16,7 @@
"@pie-lib/editable-html-tip-tap": "1.1.1-next.1",
"@pie-lib/render-ui": "5.1.1-next.0",
"debug": "^4.1.1",
- "lodash": "^4.17.23",
+ "lodash-es": "^4.17.23",
"nested-property": "^0.0.7",
"pluralize": "^8.0.0",
"prop-types": "^15.8.1",
diff --git a/packages/placement-ordering/configure/src/__tests__/design.test.jsx b/packages/placement-ordering/configure/src/__tests__/design.test.jsx
index 099975ef20..e02147bcde 100644
--- a/packages/placement-ordering/configure/src/__tests__/design.test.jsx
+++ b/packages/placement-ordering/configure/src/__tests__/design.test.jsx
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import React from 'react';
-import _ from 'lodash';
+import { cloneDeep } from 'lodash-es';
import { get, set } from 'nested-property';
import { Design } from '../design';
@@ -48,8 +48,8 @@ describe('Placement Ordering', () => {
beforeEach(() => {
onModelChanged = jest.fn();
onConfigurationChanged = jest.fn();
- model = _.cloneDeep(defaultValues.model);
- configuration = _.cloneDeep(defaultValues.configuration);
+ model = cloneDeep(defaultValues.model);
+ configuration = cloneDeep(defaultValues.configuration);
});
describe('logic', () => {
diff --git a/packages/placement-ordering/configure/src/choice-editor.jsx b/packages/placement-ordering/configure/src/choice-editor.jsx
index b6d051769e..a791c2c130 100644
--- a/packages/placement-ordering/configure/src/choice-editor.jsx
+++ b/packages/placement-ordering/configure/src/choice-editor.jsx
@@ -1,8 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import debug from 'debug';
-import shuffle from 'lodash/shuffle';
-import isEqual from 'lodash/isEqual';
+import { isEqual, shuffle } from 'lodash-es';
import Button from '@mui/material/Button';
import { styled } from '@mui/material/styles';
import { InputContainer } from '@pie-lib/render-ui';
@@ -218,17 +217,11 @@ class ChoiceEditor extends React.Component {
{orderError && {orderError}}
-
+
{`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}
-
+
{`ADD ${singularChoiceLabel}`.toUpperCase()}
diff --git a/packages/placement-ordering/configure/src/design.jsx b/packages/placement-ordering/configure/src/design.jsx
index 633b3fa6b4..eebcf01352 100644
--- a/packages/placement-ordering/configure/src/design.jsx
+++ b/packages/placement-ordering/configure/src/design.jsx
@@ -1,10 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import debug from 'debug';
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep, isEmpty } from 'lodash-es';
import { get, set } from 'nested-property';
import pluralize from 'pluralize';
-import isEmpty from 'lodash/isEmpty';
import { styled } from '@mui/material/styles';
import Info from '@mui/icons-material/Info';
import Tooltip from '@mui/material/Tooltip';
@@ -22,13 +21,13 @@ const { Panel, toggle, radio, dropdown } = settings;
const getSingularAndPlural = (label) =>
!pluralize.isPlural(label)
? {
- singularLabel: label,
- pluralLabel: pluralize(label),
- }
+ singularLabel: label,
+ pluralLabel: pluralize(label),
+ }
: {
- singularLabel: pluralize.singular(label),
- pluralLabel: label,
- };
+ singularLabel: pluralize.singular(label),
+ pluralLabel: label,
+ };
const StyledInputContainer = styled(InputContainer)(({ theme }) => ({
width: '100%',
@@ -133,23 +132,23 @@ export class Design extends React.Component {
const target = over.data.current;
const source = active.data.current;
- const rawFrom = ordering.tiles.find(t => t.id === source.id && t.type === source.type);
+ const rawFrom = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);
const rawTo = target;
const from = {
- ...rawFrom,
- index: normalizeIndex(rawFrom, ordering)
+ ...rawFrom,
+ index: normalizeIndex(rawFrom, ordering),
};
const to = {
...rawTo,
- index: normalizeIndex(rawTo, ordering)
+ index: normalizeIndex(rawTo, ordering),
};
const { response, choices: updatedChoices } = updateResponseOrChoices(
ordering.response,
ordering.choices,
from,
- to
+ to,
);
this.onChoiceEditorChange(updatedChoices, response);
@@ -202,7 +201,7 @@ export class Design extends React.Component {
teacherInstructions: teacherInstructionsError,
} = errors || {};
- const ordering = {
+ const ordering = {
choices: model.choices,
response: !correctResponse || isEmpty(correctResponse) ? new Array(model.choices.length) : correctResponse,
tiles: buildTiles(model.choices, correctResponse),
@@ -313,23 +312,18 @@ export class Design extends React.Component {
)}
-
+
{choiceLabelEnabled && (
-
+
+
{ },
- onConfigurationChanged: () => { },
+ onModelChanged: () => {},
+ onConfigurationChanged: () => {},
};
Design.propTypes = {
diff --git a/packages/placement-ordering/configure/src/index.js b/packages/placement-ordering/configure/src/index.js
index ac300ca891..b6b145c5a1 100644
--- a/packages/placement-ordering/configure/src/index.js
+++ b/packages/placement-ordering/configure/src/index.js
@@ -10,7 +10,7 @@ import Main from './design';
import React from 'react';
import { createRoot } from 'react-dom/client';
import defaultValues from './defaults';
-import defaults from 'lodash/defaults';
+import { defaults } from 'lodash-es';
const prepareCustomizationObject = (config, model) => {
const configuration = defaults(config, defaultValues.configuration);
@@ -118,7 +118,7 @@ export default class PlacementOrdering extends HTMLElement {
// check if the language is already included in the languageChoices.options array
// and if not, then add it.
- if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
+ if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {
this._configuration.languageChoices.options.push({
value: this._model.language,
label: this._model.language,
diff --git a/packages/placement-ordering/configure/src/utils.js b/packages/placement-ordering/configure/src/utils.js
index 345ac38137..73811d5269 100644
--- a/packages/placement-ordering/configure/src/utils.js
+++ b/packages/placement-ordering/configure/src/utils.js
@@ -1,4 +1,4 @@
-import cloneDeep from 'lodash/cloneDeep';
+import { cloneDeep } from 'lodash-es';
export const generateValidationMessage = () => {
const answersMessage =
@@ -100,4 +100,4 @@ export function buildTiles(choices, response) {
});
return processedChoices.concat(targets);
-}
\ No newline at end of file
+}
diff --git a/packages/placement-ordering/controller/package.json b/packages/placement-ordering/controller/package.json
index 7d96c49e09..ab650238b7 100644
--- a/packages/placement-ordering/controller/package.json
+++ b/packages/placement-ordering/controller/package.json
@@ -10,6 +10,6 @@
"@pie-lib/translator": "3.1.1-next.0",
"debug": "^4.1.1",
"js-combinatorics": "^0.5.4",
- "lodash": "^4.17.23"
+ "lodash-es": "^4.17.23"
}
}
diff --git a/packages/placement-ordering/controller/src/__tests__/index.test.js b/packages/placement-ordering/controller/src/__tests__/index.test.js
index 12669cb004..578b095349 100644
--- a/packages/placement-ordering/controller/src/__tests__/index.test.js
+++ b/packages/placement-ordering/controller/src/__tests__/index.test.js
@@ -1,9 +1,9 @@
-import _ from 'lodash';
+import { isFunction, merge } from 'lodash-es';
import * as controller from '../index';
describe('index', () => {
let base = (o) => {
- o = _.merge(
+ o = merge(
{
prompt: 'hi',
promptEnabled: true,
@@ -11,7 +11,7 @@ describe('index', () => {
correctResponse: [],
feedbackEnabled: true,
},
- o
+ o,
);
return o;
};
@@ -19,14 +19,14 @@ describe('index', () => {
describe('model', () => {
let assertModel = (q, s, e, partialExpected) => {
return async () => {
- if (_.isFunction(partialExpected) && partialExpected.name === 'Error') {
+ if (isFunction(partialExpected) && partialExpected.name === 'Error') {
expect(() => controller.model(q, s, e)).toThrow(Error);
return Promise.resolve();
} else {
const result = await controller.model(q, s, e);
- if (_.isFunction(partialExpected)) {
+ if (isFunction(partialExpected)) {
return partialExpected(result);
} else {
expect(result).toMatchObject(partialExpected);
@@ -37,22 +37,16 @@ describe('index', () => {
it(
'returns prompt',
- assertModel(base(), {}, {}, (m) => expect(m.prompt).toEqual('hi'))
+ assertModel(base(), {}, {}, (m) => expect(m.prompt).toEqual('hi')),
);
- it(
- 'returns empty config for mode=gather',
- assertModel(base(), {}, { mode: 'gather' }, {})
- );
+ it('returns empty config for mode=gather', assertModel(base(), {}, { mode: 'gather' }, {}));
- it(
- 'returns empty config for mode=view',
- assertModel(base(), {}, { mode: 'view' }, { disabled: true })
- );
+ it('returns empty config for mode=view', assertModel(base(), {}, { mode: 'view' }, { disabled: true }));
it(
'returns config.disabled=true for mode=evaluate',
- assertModel(base(), {}, { mode: 'evaluate' }, { disabled: true })
+ assertModel(base(), {}, { mode: 'evaluate' }, { disabled: true }),
);
it(
@@ -64,8 +58,8 @@ describe('index', () => {
}),
{ value: ['a', 'b'] },
{ mode: 'evaluate' },
- { feedback: 'foo' }
- )
+ { feedback: 'foo' },
+ ),
);
describe('choices and outcomes', () => {
@@ -96,8 +90,8 @@ describe('index', () => {
{ id: 'b', label: 'b' },
{ label: 'c', id: 'c' },
],
- }
- )
+ },
+ ),
);
// Main Correct Response
@@ -109,7 +103,7 @@ describe('index', () => {
{ id: 'b', outcome: 'correct' },
{ id: 'c', outcome: 'correct' },
],
- })
+ }),
);
// Alternate Correct Response
@@ -121,7 +115,7 @@ describe('index', () => {
{ id: 'b', outcome: 'correct' },
{ id: 'a', outcome: 'correct' },
],
- })
+ }),
);
// Main Correct Response
@@ -129,7 +123,7 @@ describe('index', () => {
'returns outcomes - 1 correct',
assertModel(model, { value: ['a'] }, env, {
outcomes: [{ id: 'a', outcome: 'correct' }],
- })
+ }),
);
// Alternate Correct Response
@@ -137,13 +131,10 @@ describe('index', () => {
'returns outcomes for alternate - 1 correct',
assertModel(model, { value: ['c'] }, env, {
outcomes: [{ id: 'c', outcome: 'correct' }],
- })
+ }),
);
- it(
- 'does not return config.correctResponse - 1 correct',
- assertModel(model, session, env, { disabled: true })
- );
+ it('does not return config.correctResponse - 1 correct', assertModel(model, session, env, { disabled: true }));
it(
'returns outcomes - 2 incorrect',
@@ -152,27 +143,21 @@ describe('index', () => {
{ id: 'b', outcome: 'incorrect' },
{ id: 'a', outcome: 'incorrect' },
],
- })
+ }),
);
it(
'returns config.correctResponse - 2 - incorrect',
assertModel(model, { value: ['b', 'a'] }, env, {
correctResponse: ['a', 'b', 'c'],
- })
+ }),
);
});
describe('session not set', () => {
const assertModelCorrectness = (session) => {
- it(`returns correctness: incorrect of session is ${JSON.stringify(
- session
- )}`, async () => {
- const m = await controller.model(
- base({ correctResponse: ['a', 'b'] }),
- session,
- { mode: 'evaluate' }
- );
+ it(`returns correctness: incorrect of session is ${JSON.stringify(session)}`, async () => {
+ const m = await controller.model(base({ correctResponse: ['a', 'b'] }), session, { mode: 'evaluate' });
expect(m.correctness).toEqual('incorrect');
});
};
@@ -240,7 +225,7 @@ describe('index', () => {
describe('outcome', () => {
const assertOutcome = (question, value, expectedScore, env) => {
it(`${expectedScore} when answer: ${value} and question: ${JSON.stringify(
- question
+ question,
)}, env: ${JSON.stringify(env)}`, async () => {
const result = await controller.outcome(question, { value }, env);
expect(result.score).toEqual(expectedScore);
@@ -248,17 +233,11 @@ describe('index', () => {
};
const assertOutcomeError = (question, session, env) => {
it(`throws error for ${JSON.stringify(question)}`, () =>
- expect(controller.outcome(question, session, env)).rejects.toThrow(
- controller.questionError()
- ));
+ expect(controller.outcome(question, session, env)).rejects.toThrow(controller.questionError()));
};
const assertOutcomeSessionNotset = (session) => {
- it(`return score: 0 and empty: true if session is ${JSON.stringify(
- session
- )}`, () =>
- expect(
- controller.outcome({}, session, { mode: 'evaluate' })
- ).resolves.toEqual({ score: 0, empty: true }));
+ it(`return score: 0 and empty: true if session is ${JSON.stringify(session)}`, () =>
+ expect(controller.outcome({}, session, { mode: 'evaluate' })).resolves.toEqual({ score: 0, empty: true }));
};
assertOutcomeError(null, { value: [] }, {});
@@ -277,7 +256,7 @@ describe('index', () => {
alternateResponses: [{ response: ['c'] }],
},
['a'],
- 1
+ 1,
);
assertOutcome(
{
@@ -286,7 +265,7 @@ describe('index', () => {
alternateResponses: [{ response: ['c'] }],
},
['b'],
- 0
+ 0,
);
assertOutcome(
{
@@ -294,20 +273,16 @@ describe('index', () => {
alternateResponses: [{ response: ['b', 'c', 'a'] }],
},
['c', 'a', 'b'],
- 0.33
- );
- assertOutcome(
- { correctResponse: ['a', 'b'], alternateResponses: [['c', 'b']] },
- ['c', 'a', 'b'],
- 0
+ 0.33,
);
+ assertOutcome({ correctResponse: ['a', 'b'], alternateResponses: [['c', 'b']] }, ['c', 'a', 'b'], 0);
assertOutcome(
{
correctResponse: ['a', 'b', 'c'],
alternateResponses: [{ response: ['a', 'c', 'b'] }],
},
['a', 'b'],
- 0.33
+ 0.33,
);
assertOutcome(
{
@@ -316,7 +291,7 @@ describe('index', () => {
alternateResponses: [{ response: ['a', 'b'] }],
},
['c', 'a', 'b'],
- 0.33
+ 0.33,
);
assertOutcome(
{
@@ -325,7 +300,7 @@ describe('index', () => {
alternateResponses: [{ response: ['a', 'c', 'b'] }],
},
['a', 'b'],
- 0
+ 0,
);
assertOutcome(
{
@@ -335,7 +310,7 @@ describe('index', () => {
},
['c', 'a', 'b'],
0,
- { partialScoring: true }
+ { partialScoring: true },
);
// Alternate Correct Response
@@ -346,7 +321,7 @@ describe('index', () => {
alternateResponses: [{ response: ['c'] }],
},
['c'],
- 1
+ 1,
);
assertOutcome(
{
@@ -355,7 +330,7 @@ describe('index', () => {
alternateResponses: [{ response: ['c'] }],
},
['b'],
- 0
+ 0,
);
assertOutcome(
{
@@ -363,20 +338,16 @@ describe('index', () => {
alternateResponses: [{ response: ['c', 'b', 'a'] }],
},
['c', 'a', 'b'],
- 0.67
- );
- assertOutcome(
- { correctResponse: ['a', 'b'], alternateResponses: [{ response: ['c', 'b'] }] },
- ['c', 'a', 'b'],
- 0
+ 0.67,
);
+ assertOutcome({ correctResponse: ['a', 'b'], alternateResponses: [{ response: ['c', 'b'] }] }, ['c', 'a', 'b'], 0);
assertOutcome(
{
correctResponse: ['a', 'b', 'c'],
alternateResponses: [{ response: ['c', 'b', 'a'] }],
},
['c', 'b'],
- 0.33
+ 0.33,
);
assertOutcome(
{
@@ -385,7 +356,7 @@ describe('index', () => {
alternateResponses: [{ response: ['a', 'c', 'b'] }],
},
['c', 'a', 'b'],
- 0.67
+ 0.67,
);
assertOutcome(
{
@@ -394,7 +365,7 @@ describe('index', () => {
alternateResponses: [{ response: ['a', 'c', 'b'] }],
},
['a', 'b'],
- 0
+ 0,
);
assertOutcome(
{
@@ -404,7 +375,7 @@ describe('index', () => {
},
['c', 'a', 'b'],
0,
- { partialScoring: true }
+ { partialScoring: true },
);
});
});
diff --git a/packages/placement-ordering/controller/src/__tests__/scoring.test.js b/packages/placement-ordering/controller/src/__tests__/scoring.test.js
index b91458797d..12490b8aaf 100644
--- a/packages/placement-ordering/controller/src/__tests__/scoring.test.js
+++ b/packages/placement-ordering/controller/src/__tests__/scoring.test.js
@@ -1,5 +1,5 @@
import { flattenCorrect, score, pairwiseCombinationScore, illegalArgumentError } from '../scoring';
-import _ from 'lodash';
+import { cloneDeep, merge } from 'lodash-es';
describe('pairwiseCombinationScore', () => {
const assertScore = (correctResponse, opts) => (answer, expectedScore) => {
@@ -113,7 +113,7 @@ describe('score', () => {
};
describe('partial scoring', () => {
- let question = _.merge(_.cloneDeep(baseQuestion), {
+ let question = merge(cloneDeep(baseQuestion), {
partialScoring: true,
});
diff --git a/packages/placement-ordering/controller/src/index.js b/packages/placement-ordering/controller/src/index.js
index f4d7d87a90..c2029a68a3 100644
--- a/packages/placement-ordering/controller/src/index.js
+++ b/packages/placement-ordering/controller/src/index.js
@@ -1,13 +1,11 @@
import { flattenCorrect, getAllCorrectResponses, score } from './scoring';
-import _ from 'lodash';
+import { every, isArray, isEmpty, isEqual, map, reduce } from 'lodash-es';
import { getFeedbackForCorrectness } from '@pie-lib/feedback';
import { partialScoring } from '@pie-lib/controller-utils';
import debug from 'debug';
import defaults from './defaults';
-import isEqual from 'lodash/isEqual';
-import isEmpty from 'lodash/isEmpty';
const log = debug('@pie-element:placement-ordering:controller');
import Translator from '@pie-lib/translator';
@@ -18,11 +16,11 @@ export const questionError = () => new Error('Question is missing required array
export function outcome(question, session, env) {
return new Promise((resolve, reject) => {
- if (!session || _.isEmpty(session)) {
+ if (!session || isEmpty(session)) {
resolve({ score: 0, empty: true });
}
- if (!question || !question.correctResponse || _.isEmpty(question.correctResponse)) {
+ if (!question || !question.correctResponse || isEmpty(question.correctResponse)) {
reject(questionError());
} else {
try {
@@ -64,106 +62,105 @@ export const normalize = (question) => ({
* @param {*} env
*/
export async function model(question, session, env) {
- const normalizedQuestion = normalize(question);
- const base = {};
+ const normalizedQuestion = normalize(question);
+ const base = {};
- if (question.alternateResponses && _.every(question.alternateResponses, _.isArray)) {
- log('Deprecated structure of alternateResponses is in use');
- // eslint-disable-next-line no-console
- console.error('Deprecated structure of alternateResponses is in use');
- }
+ if (question.alternateResponses && every(question.alternateResponses, isArray)) {
+ log('Deprecated structure of alternateResponses is in use');
+ // eslint-disable-next-line no-console
+ console.error('Deprecated structure of alternateResponses is in use');
+ }
- base.env = env;
- base.extraCSSRules = normalizedQuestion.extraCSSRules;
- base.outcomes = [];
- base.completeLength = (normalizedQuestion.correctResponse || []).length;
- base.choices = (normalizedQuestion.choices || []).filter((choice) => choice.label);
- base.note = normalizedQuestion.note;
- base.showNote = normalizedQuestion.alternateResponses && normalizedQuestion.alternateResponses.length > 0;
- base.language = normalizedQuestion.language;
-
- log('[model] removing tileSize for the moment.');
-
- base.prompt = normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null;
- base.config = {
- orientation: normalizedQuestion.orientation || 'vertical',
- includeTargets: normalizedQuestion.placementArea,
- choiceLabelEnabled: normalizedQuestion.choiceLabelEnabled,
- targetLabel: normalizedQuestion.targetLabel,
- choiceLabel: normalizedQuestion.choiceLabel,
- showOrdering: normalizedQuestion.numberedGuides,
- allowSameChoiceInTargets: !normalizedQuestion.removeTilesAfterPlacing,
- };
-
- base.disabled = env.mode !== 'gather';
-
- if (!base.note) {
- base.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });
- }
+ base.env = env;
+ base.extraCSSRules = normalizedQuestion.extraCSSRules;
+ base.outcomes = [];
+ base.completeLength = (normalizedQuestion.correctResponse || []).length;
+ base.choices = (normalizedQuestion.choices || []).filter((choice) => choice.label);
+ base.note = normalizedQuestion.note;
+ base.showNote = normalizedQuestion.alternateResponses && normalizedQuestion.alternateResponses.length > 0;
+ base.language = normalizedQuestion.language;
+
+ log('[model] removing tileSize for the moment.');
+
+ base.prompt = normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null;
+ base.config = {
+ orientation: normalizedQuestion.orientation || 'vertical',
+ includeTargets: normalizedQuestion.placementArea,
+ choiceLabelEnabled: normalizedQuestion.choiceLabelEnabled,
+ targetLabel: normalizedQuestion.targetLabel,
+ choiceLabel: normalizedQuestion.choiceLabel,
+ showOrdering: normalizedQuestion.numberedGuides,
+ allowSameChoiceInTargets: !normalizedQuestion.removeTilesAfterPlacing,
+ };
+
+ base.disabled = env.mode !== 'gather';
+
+ if (!base.note) {
+ base.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });
+ }
- if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
- base.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
- base.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
- ? normalizedQuestion.teacherInstructions
- : null;
- } else {
- base.rationale = null;
- base.teacherInstructions = null;
- }
+ if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
+ base.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
+ base.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
+ ? normalizedQuestion.teacherInstructions
+ : null;
+ } else {
+ base.rationale = null;
+ base.teacherInstructions = null;
+ }
- if (env.mode === 'evaluate') {
- const value = (session && session.value) || [];
- const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);
-
- const bestSetOfResponses = allCorrectResponses.reduce(
- (info, cr) => {
- const currentScore = _.reduce(value, (acc, c, idx) => acc + (Array.isArray(cr) && cr[idx] === c ? 1 : 0), 0);
-
- if (currentScore > info.score) {
- return {
- arr: cr,
- score: currentScore,
- };
- }
-
- return info;
- },
- { arr: [], score: 0 },
- );
-
- base.outcomes = _.map(value, (c, idx) => {
- return {
- id: c,
- outcome: bestSetOfResponses.arr[idx] === c ? 'correct' : 'incorrect',
- };
- });
+ if (env.mode === 'evaluate') {
+ const value = (session && session.value) || [];
+ const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);
+
+ const bestSetOfResponses = allCorrectResponses.reduce(
+ (info, cr) => {
+ const currentScore = reduce(value, (acc, c, idx) => acc + (Array.isArray(cr) && cr[idx] === c ? 1 : 0), 0);
+
+ if (currentScore > info.score) {
+ return {
+ arr: cr,
+ score: currentScore,
+ };
+ }
+
+ return info;
+ },
+ { arr: [], score: 0 },
+ );
+
+ base.outcomes = map(value, (c, idx) => {
+ return {
+ id: c,
+ outcome: bestSetOfResponses.arr[idx] === c ? 'correct' : 'incorrect',
+ };
+ });
- const isResponseCorrect = allCorrectResponses.some((response) => _.isEqual(response, value));
- const responseScore = score(question, session);
- const isCorrect = responseScore === 1;
- const isPartialCorrect =
- !isCorrect && partialScoring.enabled(normalizedQuestion, env || {}) && responseScore !== 0;
+ const isResponseCorrect = allCorrectResponses.some((response) => isEqual(response, value));
+ const responseScore = score(question, session);
+ const isCorrect = responseScore === 1;
+ const isPartialCorrect = !isCorrect && partialScoring.enabled(normalizedQuestion, env || {}) && responseScore !== 0;
- base.correctness = isCorrect ? 'correct' : isPartialCorrect ? 'partial' : 'incorrect';
+ base.correctness = isCorrect ? 'correct' : isPartialCorrect ? 'partial' : 'incorrect';
- if (!isResponseCorrect) {
- base.correctResponse = flattenCorrect(normalizedQuestion);
- }
+ if (!isResponseCorrect) {
+ base.correctResponse = flattenCorrect(normalizedQuestion);
+ }
- // requirement made in PD-2182
- if (!normalizedQuestion.feedback) {
- normalizedQuestion.feedbackEnabled = false;
- }
+ // requirement made in PD-2182
+ if (!normalizedQuestion.feedback) {
+ normalizedQuestion.feedbackEnabled = false;
+ }
- const feedback = normalizedQuestion.feedbackEnabled
- ? await getFeedbackForCorrectness(base.correctness, normalizedQuestion.feedback)
- : undefined;
+ const feedback = normalizedQuestion.feedbackEnabled
+ ? await getFeedbackForCorrectness(base.correctness, normalizedQuestion.feedback)
+ : undefined;
- base.feedback = feedback;
- return base;
- } else {
- return base;
- }
+ base.feedback = feedback;
+ return base;
+ } else {
+ return base;
+ }
}
export const createCorrectResponseSession = (question, env) => {
diff --git a/packages/placement-ordering/controller/src/scoring.js b/packages/placement-ordering/controller/src/scoring.js
index 07dea69318..b4deb05a94 100644
--- a/packages/placement-ordering/controller/src/scoring.js
+++ b/packages/placement-ordering/controller/src/scoring.js
@@ -1,4 +1,4 @@
-import _ from 'lodash';
+import { differenceWith, isEqual, uniq } from 'lodash-es';
import { combination } from 'js-combinatorics';
import debug from 'debug';
@@ -9,15 +9,15 @@ export const illegalArgumentError = (answer) =>
export const pairwiseCombinationScore = (correct, answer, opts) => {
opts = { allowDuplicates: false, orderMustBeComplete: false, ...opts };
- if (!opts.allowDuplicates && !_.isEqual(_.uniq(correct), correct)) {
+ if (!opts.allowDuplicates && !isEqual(uniq(correct), correct)) {
throw illegalArgumentError(answer);
}
- if (opts.allowDuplicates === false && answer.length !== _.uniq(answer).length) {
+ if (opts.allowDuplicates === false && answer.length !== uniq(answer).length) {
return 0;
}
- answer = opts.allowDuplicates !== false ? answer : _.uniq(answer);
+ answer = opts.allowDuplicates !== false ? answer : uniq(answer);
log('answer:', answer);
if (!Array.isArray(correct) || correct.length === 0) {
@@ -25,7 +25,7 @@ export const pairwiseCombinationScore = (correct, answer, opts) => {
}
if (correct.length === 1) {
- return _.isEqual(correct, answer) ? 1 : 0;
+ return isEqual(correct, answer) ? 1 : 0;
}
if (!Array.isArray(answer) || answer.length < 2) {
@@ -43,7 +43,7 @@ export const pairwiseCombinationScore = (correct, answer, opts) => {
const correctCombo = combination(correct, 2).toArray();
const answerCombo = combination(answer, 2).toArray();
- const diff = _.differenceWith(answerCombo, correctCombo, _.isEqual);
+ const diff = differenceWith(answerCombo, correctCombo, isEqual);
const comboLengthDiff = correctCombo.length - answerCombo.length;
@@ -67,13 +67,15 @@ export const flattenCorrect = (question) =>
* @param question - array
*/
export const getAllCorrectResponses = (question) => {
- const alternates = (question.alternateResponses || []).map((alternate) => {
- if (Array.isArray(alternate)) {
- return alternate;
- }
-
- return alternate.response;
- }).filter(item => item !== undefined);
+ const alternates = (question.alternateResponses || [])
+ .map((alternate) => {
+ if (Array.isArray(alternate)) {
+ return alternate;
+ }
+
+ return alternate.response;
+ })
+ .filter((item) => item !== undefined);
return [flattenCorrect(question), ...alternates];
};
diff --git a/packages/placement-ordering/package.json b/packages/placement-ordering/package.json
index 1658dac227..78ab4e5f12 100644
--- a/packages/placement-ordering/package.json
+++ b/packages/placement-ordering/package.json
@@ -20,7 +20,7 @@
"@pie-lib/translator": "3.1.1-next.0",
"debug": "^4.1.1",
"decimal.js": "^10.0.0",
- "lodash": "^4.17.23",
+ "lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.3.1",
"react-dom": "18.3.1",
diff --git a/packages/placement-ordering/src/__tests__/ordering.test.js b/packages/placement-ordering/src/__tests__/ordering.test.js
index 7026f1dcd0..0e7cd4c8bd 100644
--- a/packages/placement-ordering/src/__tests__/ordering.test.js
+++ b/packages/placement-ordering/src/__tests__/ordering.test.js
@@ -1,5 +1,5 @@
import { buildState, reducer } from '../ordering';
-import _ from 'lodash';
+import { chunk, take } from 'lodash-es';
describe('ordering', () => {
const toLabel = (a) => `${a[0]}->${a[1]}`;
@@ -57,7 +57,7 @@ describe('ordering', () => {
`${i.tiles.map((t) => t.id)} + ${actions.map(toLabel).join(', ')} = ${e}`;
const assertMoveLabel = (i, actions, expected) => {
- const tiles = _.take(i.tiles, 4).map((t) => t.id);
+ const tiles = take(i.tiles, 4).map((t) => t.id);
return `${tiles} + ${actions.map(toLabel)} = ${expected.choices.map((c) => c || '_')}|${expected.targets.map(
(t) => t || '_',
@@ -140,7 +140,7 @@ describe('ordering', () => {
const label = assertMoveLabel(state, actions, expected);
it(label, () => {
- let [choiceTiles, targetTiles] = _.chunk(state.tiles, 4);
+ let [choiceTiles, targetTiles] = chunk(state.tiles, 4);
expect(choiceTiles.map((t) => t.id)).toEqual(expected.choices);
expect(targetTiles.map((t) => t.id)).toEqual(expected.targets);
diff --git a/packages/placement-ordering/src/index.js b/packages/placement-ordering/src/index.js
index 8d575be87d..454f044747 100644
--- a/packages/placement-ordering/src/index.js
+++ b/packages/placement-ordering/src/index.js
@@ -1,6 +1,6 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
-import compact from 'lodash/compact';
+import { compact } from 'lodash-es';
import debug from 'debug';
import { renderMath } from '@pie-lib/math-rendering';
import { SessionChangedEvent } from '@pie-framework/pie-player-events';
diff --git a/packages/placement-ordering/src/ordering.js b/packages/placement-ordering/src/ordering.js
index 7f0962fe08..9b37eadc36 100644
--- a/packages/placement-ordering/src/ordering.js
+++ b/packages/placement-ordering/src/ordering.js
@@ -1,8 +1,5 @@
-import cloneDeep from 'lodash/cloneDeep';
+import { assign, cloneDeep, isEmpty, map } from 'lodash-es';
import debug from 'debug';
-import isEmpty from 'lodash/isEmpty';
-import map from 'lodash/map';
-import assign from 'lodash/assign';
const log = debug('pie-elements:placement-ordering:ordering');
diff --git a/packages/placement-ordering/src/placement-ordering.jsx b/packages/placement-ordering/src/placement-ordering.jsx
index 99aeaa737e..cedd7e4c8d 100644
--- a/packages/placement-ordering/src/placement-ordering.jsx
+++ b/packages/placement-ordering/src/placement-ordering.jsx
@@ -2,9 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import debug from 'debug';
-import uniqueId from 'lodash/uniqueId';
-import isEqual from 'lodash/isEqual';
-import difference from 'lodash/difference';
+import { difference, isEqual, uniqueId } from 'lodash-es';
import { styled } from '@mui/material/styles';
import { closestCenter } from '@dnd-kit/core';
@@ -244,18 +242,18 @@ export class PlacementOrdering extends React.Component {
return showingCorrect
? buildState(
- model.choices,
- model.correctResponse,
- model.correctResponse.map((id) => ({ id, outcome: 'correct' })),
- {
+ model.choices,
+ model.correctResponse,
+ model.correctResponse.map((id) => ({ id, outcome: 'correct' })),
+ {
+ includeTargets,
+ allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,
+ },
+ )
+ : buildState(model.choices, session.value, model.outcomes, {
includeTargets,
allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,
- },
- )
- : buildState(model.choices, session.value, model.outcomes, {
- includeTargets,
- allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,
- });
+ });
};
onDragEnd = (event) => {
@@ -280,7 +278,7 @@ export class PlacementOrdering extends React.Component {
this.onRemoveChoice(draggedItem, ordering);
}
}
- }
+ };
render() {
const { model } = this.props;
@@ -365,7 +363,10 @@ export class PlacementOrdering extends React.Component {
{displayNote && }
{showRationale && (
-
+
)}
diff --git a/packages/rubric/controller/package.json b/packages/rubric/controller/package.json
index 973814b76d..84e5d29315 100644
--- a/packages/rubric/controller/package.json
+++ b/packages/rubric/controller/package.json
@@ -7,6 +7,6 @@
"test": "./node_modules/.bin/jest"
},
"dependencies": {
- "lodash": "^4.17.15"
+ "lodash-es": "^4.17.23"
}
}
diff --git a/packages/rubric/src/print.js b/packages/rubric/src/print.js
index 7b7243686f..2d32ca376e 100644
--- a/packages/rubric/src/print.js
+++ b/packages/rubric/src/print.js
@@ -1,6 +1,6 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash-es';
import Main from './main';
import { renderMath } from '@pie-lib/math-rendering';
import debug from 'debug';
diff --git a/packages/select-text/configure/package.json b/packages/select-text/configure/package.json
index 0c831a765f..d8b4dce4b0 100644
--- a/packages/select-text/configure/package.json
+++ b/packages/select-text/configure/package.json
@@ -15,7 +15,7 @@
"@pie-lib/editable-html-tip-tap": "1.1.1-next.1",
"@pie-lib/text-select": "2.1.1-next.0",
"debug": "^4.1.1",
- "lodash": "^4.17.15",
+ "lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0"
diff --git a/packages/select-text/configure/src/__tests__/design.test.jsx b/packages/select-text/configure/src/__tests__/design.test.jsx
index d324aac23f..e2c3d00c9d 100644
--- a/packages/select-text/configure/src/__tests__/design.test.jsx
+++ b/packages/select-text/configure/src/__tests__/design.test.jsx
@@ -18,7 +18,10 @@ jest.mock('@pie-lib/config-ui', () => ({
},
}));
-jest.mock('lodash/debounce', () => (fn) => fn);
+jest.mock('lodash-es', () => ({
+ debounce: jest.fn((fn) => fn),
+ cloneDeep: jest.fn((value) => JSON.parse(JSON.stringify(value))),
+}));
describe('design', () => {
let w;
diff --git a/packages/select-text/configure/src/design.jsx b/packages/select-text/configure/src/design.jsx
index 79bf8cdfe3..45d0d4ae9f 100644
--- a/packages/select-text/configure/src/design.jsx
+++ b/packages/select-text/configure/src/design.jsx
@@ -2,8 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import TextField from '@mui/material/TextField';
import { styled } from '@mui/material/styles';
-import cloneDeep from 'lodash/cloneDeep';
-import debounce from 'lodash/debounce';
+import { cloneDeep, debounce } from 'lodash-es';
import { Tokenizer } from '@pie-lib/text-select';
import { InputContainer, NumberTextField, FeedbackConfig, settings, layout } from '@pie-lib/config-ui';
import Chip from '@mui/material/Chip';
@@ -342,38 +341,23 @@ export class Design extends React.Component {
{tokens.settings && (
-
+
-
+
)}
{tokensError && {tokensError}}
{selectionsError && {selectionsError}}
- {mode.settings && (
-
- )}
+ {mode.settings && }
- {selections.settings && (
-
- )}
+ {selections.settings && }
{correctAnswer.settings && (
- t.correct).length}`}
- />
+ t.correct).length}`} />
)}
{selectionCount.settings && (
diff --git a/packages/select-text/controller/package.json b/packages/select-text/controller/package.json
index 38c2331fa3..56f1327860 100644
--- a/packages/select-text/controller/package.json
+++ b/packages/select-text/controller/package.json
@@ -9,11 +9,9 @@
"@pie-lib/controller-utils": "1.1.1-next.0",
"@pie-lib/feedback": "1.1.1-next.0",
"debug": "^4.1.1",
- "lodash": "^4.17.15"
- },
- "devDependencies": {
- "lodash": "^4.17.15"
+ "lodash-es": "^4.17.23"
},
+ "devDependencies": {},
"author": "",
"license": "ISC"
}
diff --git a/packages/select-text/controller/src/__tests__/index.test.js b/packages/select-text/controller/src/__tests__/index.test.js
index 6e6d82e156..531480ace4 100644
--- a/packages/select-text/controller/src/__tests__/index.test.js
+++ b/packages/select-text/controller/src/__tests__/index.test.js
@@ -1,5 +1,5 @@
import { getPartialScore, getCorrectness, model, outcome, createCorrectResponseSession } from '../index';
-import isFunction from 'lodash/isFunction';
+import { isFunction } from 'lodash-es';
jest.mock('@pie-lib/text-select', () => ({
prepareText: jest.fn(),
diff --git a/packages/select-text/controller/src/index.js b/packages/select-text/controller/src/index.js
index 76d496ace4..c7e96b30f2 100644
--- a/packages/select-text/controller/src/index.js
+++ b/packages/select-text/controller/src/index.js
@@ -1,5 +1,5 @@
import debug from 'debug';
-import isEmpty from 'lodash/isEmpty';
+import { isEmpty } from 'lodash-es';
import { getFeedbackForCorrectness } from '@pie-lib/feedback';
import { partialScoring } from '@pie-lib/controller-utils';
import defaults from './defaults';
diff --git a/packages/select-text/src/print.js b/packages/select-text/src/print.js
index 730013a574..2a6f6607ce 100644
--- a/packages/select-text/src/print.js
+++ b/packages/select-text/src/print.js
@@ -1,6 +1,6 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash-es';
import Main from './main';
import { renderMath } from '@pie-lib/math-rendering';
import debug from 'debug';
diff --git a/pslb/pslb.config.js b/pslb/pslb.config.js
index fcbccc8cd7..66b3260ed7 100644
--- a/pslb/pslb.config.js
+++ b/pslb/pslb.config.js
@@ -1,6 +1,5 @@
const path = require('path');
const fs = require('fs-extra');
-const _ = require('lodash');
const blacklist = ['pie-models', 'math-inline', 'protractor', 'ruler', 'calculator', 'select-text'];
@@ -12,20 +11,19 @@ const listPackages = () => {
const files = fs.readdirSync(packagesDir);
- return _.compact(
- files
- .filter((f) => !f.includes('@'))
-
- .filter((f) => !blacklist.includes(f))
- .map((f) => {
- try {
- const rootPkg = fs.readJsonSync(path.join(packagesDir, f, 'package.json'));
- return rootPkg.name;
- } catch (e) {
- console.warn(`error for: ${f}, ${e.message}`);
- }
- }),
- );
+ return files
+ .filter((f) => !f.includes('@'))
+ .filter((f) => !blacklist.includes(f))
+ .map((f) => {
+ try {
+ const rootPkg = fs.readJsonSync(path.join(packagesDir, f, 'package.json'));
+ return rootPkg.name;
+ } catch (e) {
+ console.warn(`error for: ${f}, ${e.message}`);
+ return null;
+ }
+ })
+ .filter(Boolean);
};
module.exports = {
diff --git a/scripts/build b/scripts/build
index 7d631fc040..4ee8761237 100755
--- a/scripts/build
+++ b/scripts/build
@@ -4,7 +4,6 @@ const debug = require('debug');
const log = debug('pie-element:scripts:build');
const argv = require('minimist')(process.argv.slice(2));
const { readdirSync, pathExistsSync, readJson } = require('fs-extra');
-const _ = require('lodash');
const { Commands, getPackage } = require('@pie-framework/build-helper');
const { resolve, relative, join } = require('path');
const minimist = require('minimist');
@@ -14,8 +13,7 @@ const toPkgFlag = (p) => `--package ${p.pkg.name}`;
const args = minimist(process.argv.slice(2));
-const r = (...parts) =>
- resolve.apply(null, [__dirname, '..', 'packages'].concat(parts));
+const r = (...parts) => resolve.apply(null, [__dirname, '..', 'packages'].concat(parts));
const rel = (p) => relative(resolve(__dirname, '..'), p);
@@ -36,7 +34,7 @@ const expandPkg = (d) => {
const getElementPackages = (dir) => {
const dirs = readdirSync(dir);
- const all = _.flatten(dirs.map((d) => expandPkg(d)));
+ const all = dirs.map((d) => expandPkg(d)).flat();
const out = all.map(getPackage);
return out;
};
@@ -56,7 +54,7 @@ class ElementsCommands extends Commands {
const cwd = resolve(__dirname, '..', p.dir);
log('cwd:', cwd);
return this.runCmd('rm -fr lib', { cwd });
- })
+ }),
);
}
@@ -67,20 +65,16 @@ class ElementsCommands extends Commands {
allPackages.map(async (n) => {
const dir = resolve(root, n);
return { dir, pkg: await readJson(resolve(dir, 'package.json')) };
- })
+ }),
);
- const printPkgs = pkgJson.filter(
- (p) => p.pkg.exports && p.pkg.exports['./print']
- );
+ const printPkgs = pkgJson.filter((p) => p.pkg.exports && p.pkg.exports['./print']);
console.log(
'printPkgs',
- printPkgs.map((p) => p.dir)
+ printPkgs.map((p) => p.dir),
);
- const cmd = `yarn pslb --config pslb/pslb.config.js ${printPkgs
- .map(toPkgFlag)
- .join(' ')} --logLevel silly`;
+ const cmd = `yarn pslb --config pslb/pslb.config.js ${printPkgs.map(toPkgFlag).join(' ')} --logLevel silly`;
return this.runCmd(cmd);
}
@@ -90,22 +84,32 @@ class ElementsCommands extends Commands {
}
async babel() {
- const packages = getElementPackages(join(this.projectRoot, 'packages'))
- .filter((p) => pathExistsSync(join(p.dir, 'src')));
-
+ const packages = getElementPackages(join(this.projectRoot, 'packages')).filter((p) =>
+ pathExistsSync(join(p.dir, 'src')),
+ );
+
+ // Splits an array into chunks of a given size. Equivalent to lodash's `chunk` for normal usage.
+ const chunk = (arr, size) => {
+ const out = [];
+ for (let i = 0; i < arr.length; i += size) {
+ out.push(arr.slice(i, i + size));
+ }
+ return out;
+ };
+
// Process packages in batches to avoid OOM in CI environments
// Each babel process spawns a new Node.js process, so running
// all in parallel can exhaust memory. Batches of 3 balance speed and memory.
const batchSize = 3;
- const batches = _.chunk(packages, batchSize);
-
+ const batches = chunk(packages, batchSize);
+
for (const batch of batches) {
await Promise.all(
batch.map((p) => {
const cwd = resolve(__dirname, '..', p.dir);
const cmd = `${this.p.babel} --ignore '**/__test__/**','**/__tests__/**','**/__mocks__/**' src -d lib --source-maps --root-mode upward`;
return this.runCmd(cmd, { cwd });
- })
+ }),
);
}
}
diff --git a/scripts/fix-versions b/scripts/fix-versions
index 4e57fda408..cb928b715e 100755
--- a/scripts/fix-versions
+++ b/scripts/fix-versions
@@ -6,7 +6,6 @@ const { execSync } = require('child_process');
const minimist = require('minimist');
const args = minimist(process.argv.slice(2));
const semver = require('semver');
-const _ = require('lodash');
console.log('fix versions');
const dirs = fs.readdirSync('packages');
@@ -30,18 +29,11 @@ dirs
if (index >= 0) {
console.log(pkg.name, pkg.version, 'needs fixing');
- const versions = _(rows)
+ const versions = rows
.filter((r) => r.startsWith(`${pkg.name}@`))
.map((r) => r.replace(`${pkg.name}@`, ''))
.filter(semver.valid)
- .sort(semver.compare)
- .value();
- // const versions = rows
- // .filter((r) => {
- // return r.startsWith(`${pkg.name}@`);
- // })
- // .map((r) => r.replace(`${pkg.name}@`, ''))
- // .sort();
+ .sort(semver.compare);
const last = versions[versions.length - 1];
diff --git a/scripts/hooks/shared.js b/scripts/hooks/shared.js
index 4646c49e2b..81a9cfb751 100644
--- a/scripts/hooks/shared.js
+++ b/scripts/hooks/shared.js
@@ -1,7 +1,6 @@
const { execSync } = require('child_process');
const { readdirSync, readJsonSync, writeJsonSync, readFileSync, pathExistsSync } = require('fs-extra');
-const _ = require('lodash');
const debug = require('debug');
const chalk = require('chalk');
const minimist = require('minimist');
@@ -29,18 +28,17 @@ const pkgInfo = (dir) => {
exports.getPackageFiles = () => {
const root = resolve(__dirname, '..', '..', 'packages');
const dirs = readdirSync(root);
- return _(
- dirs.map((d) => {
- const out = [];
- out.push(pkgInfo(join(root, d)));
- out.push(pkgInfo(join(root, d, 'controller')));
- out.push(pkgInfo(join(root, d, 'configure')));
- return out;
- }),
- )
- .flatten()
- .compact()
- .value();
+
+ return dirs
+ .map((d) => {
+ const base = pkgInfo(join(root, d));
+ const controller = pkgInfo(join(root, d, 'controller'));
+ const configure = pkgInfo(join(root, d, 'configure'));
+
+ return [base, controller, configure];
+ })
+ .flat()
+ .filter(Boolean);
};
const getSatisfyingVersions = async (name, range) => {
@@ -103,7 +101,14 @@ exports.checkDependencies = async (lock, i) => {
}),
);
- const groups = _.groupBy(_.compact(results), (r) => (r.version ? 'fixable' : 'notFixable'));
+ const groups = results.filter(Boolean).reduce(
+ (acc, r) => {
+ const key = r.version ? 'fixable' : 'notFixable';
+ acc[key].push(r);
+ return acc;
+ },
+ { fixable: [], notFixable: [] },
+ );
groups.fixable = groups.fixable
? groups.fixable.reduce((acc, d) => {
@@ -118,5 +123,6 @@ exports.checkDependencies = async (lock, i) => {
return acc;
}, {})
: undefined;
+
return { ...i, ...groups };
};
diff --git a/scripts/rm-bad-versions.js b/scripts/rm-bad-versions.js
index 8b9eb0a194..16c2162294 100644
--- a/scripts/rm-bad-versions.js
+++ b/scripts/rm-bad-versions.js
@@ -3,7 +3,6 @@ const { getPackages } = require('@pie-framework/build-helper');
const { resolve } = require('path');
const { execSync } = require('child_process');
const semver = require('semver');
-const _ = require('lodash');
const pkgs = getPackages(resolve(__dirname, '..', 'packages'));
diff --git a/yarn.lock b/yarn.lock
index 60a3dfe079..a819d33f48 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3955,12 +3955,14 @@
resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76"
integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==
-"@types/lodash@^4.14.119":
- version "4.17.20"
- resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.20.tgz#1ca77361d7363432d29f5e55950d9ec1e1c6ea93"
- integrity sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==
+"@types/lodash-es@^4.17.12":
+ version "4.17.12"
+ resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b"
+ integrity sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==
+ dependencies:
+ "@types/lodash" "*"
-"@types/lodash@^4.14.172":
+"@types/lodash@*", "@types/lodash@^4.14.172":
version "4.17.23"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.23.tgz#c1bb06db218acc8fc232da0447473fc2fb9d9841"
integrity sha512-RDvF6wTulMPjrNdCoYRC8gNR880JNGT8uB+REUpC2Ns4pRqQJhGz90wh7rgdXDPpCczF3VGktDuFGVnz8zP7HA==
@@ -10769,6 +10771,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
+lodash-es@^4.17.23:
+ version "4.17.23"
+ resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.23.tgz#58c4360fd1b5d33afc6c0bbd3d1149349b1138e0"
+ integrity sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==
+
lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"