refactor: replace @edx/paragon and @edx/frontend-build (#294)

* refactor: replace @edx/paragon and @edx/frontend-build

* refactor: updated edx packages

* fix: fixed failing test cases by remmoving paragon mock

* fix: updated lock file to fix build issues

---------

Co-authored-by: mashal-m <mashal.malik@arbisoft.com>
Co-authored-by: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com>
Co-authored-by: Muhammad Abdullah Waheed <abdullah.waheed@arbisoft.com>
This commit is contained in:
Mashal Malik
2024-02-28 13:04:23 -03:00
committed by GitHub
parent 836df49829
commit f67ffdd480
60 changed files with 3594 additions and 3515 deletions

View File

@@ -1,4 +1,5 @@
const { createConfig } = require('@edx/frontend-build');
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@openedx/frontend-build');
const config = createConfig('eslint', {
rules: {

View File

@@ -1,4 +1,4 @@
const { createConfig } = require('@edx/frontend-build');
const { createConfig } = require('@openedx/frontend-build');
module.exports = createConfig('jest', {
setupFilesAfterEnv: [
@@ -15,8 +15,4 @@ module.exports = createConfig('jest', {
],
testTimeout: 120000,
testEnvironment: 'jsdom',
moduleNameMapper: {
'^@openedx/paragon$': '<rootDir>/mockParagon.js',
'^@openedx/paragon/(.*)$': '<rootDir>/mockParagon.js',
},
});

View File

@@ -1 +0,0 @@
module.exports = {};

6951
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,15 +25,15 @@
},
"dependencies": {
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-footer": "12.7.1",
"@edx/frontend-component-header": "4.11.1",
"@edx/frontend-platform": "5.6.1",
"@edx/frontend-component-footer": "13.0.2",
"@edx/frontend-component-header": "5.0.2",
"@edx/frontend-platform": "7.1.0",
"@edx/openedx-atlas": "^0.6.0",
"@edx/paragon": "^20.44.0",
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.2.0",
"@openedx/paragon": "21.11.3",
"@redux-beacon/segment": "^1.1.0",
"@reduxjs/toolkit": "^1.6.1",
"@testing-library/user-event": "^14.0.0",
@@ -55,7 +55,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-intl": "^5.20.9",
"react-intl": "6.4.7",
"react-pdf": "^5.5.0",
"react-redux": "^7.2.9",
"react-router": "6.21.3",
@@ -73,9 +73,9 @@
},
"devDependencies": {
"@edx/browserslist-config": "^1.2.0",
"@edx/frontend-build": "13.0.1",
"@edx/react-unit-test-utils": "1.7.1",
"@edx/react-unit-test-utils": "2.0.0",
"@edx/reactifex": "^2.1.1",
"@openedx/frontend-build": "13.0.28",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "12.1.5",
"axios-mock-adapter": "^1.20.0",

View File

@@ -1,7 +1,7 @@
// frontend-app-*/src/index.scss
@import "~@edx/brand/paragon/fonts";
@import "~@edx/brand/paragon/variables";
@import "~@edx/paragon/scss/core/core";
@import "~@openedx/paragon/scss/core/core";
@import "~@edx/brand/paragon/overrides";
$fa-font-path: "~font-awesome/fonts";

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { AlertModal, ActionRow, Button } from '@edx/paragon';
import { AlertModal, ActionRow, Button } from '@openedx/paragon';
import { nullMethod } from 'hooks';
export const ConfirmModal = ({

View File

@@ -6,7 +6,7 @@ import {
ActionRow,
AlertModal,
Button,
} from '@edx/paragon';
} from '@openedx/paragon';
import messages from './messages';

View File

@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button } from '@edx/paragon';
import { Info } from '@edx/paragon/icons';
import { Alert, Button } from '@openedx/paragon';
import { Info } from '@openedx/paragon/icons';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
const messageShape = PropTypes.shape({

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { Alert, Spinner } from '@edx/paragon';
import { Alert, Spinner } from '@openedx/paragon';
export const LoadingBanner = () => (
<Alert variant="info">

View File

@@ -4,8 +4,8 @@ import PropTypes from 'prop-types';
import { pdfjs, Document, Page } from 'react-pdf';
import {
Icon, Form, ActionRow, IconButton,
} from '@edx/paragon';
import { ChevronLeft, ChevronRight } from '@edx/paragon/icons';
} from '@openedx/paragon';
import { ChevronLeft, ChevronRight } from '@openedx/paragon/icons';
import pdfjsWorker from 'react-pdf/dist/esm/pdf.worker.entry';
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Card, Collapsible } from '@edx/paragon';
import { Card, Collapsible } from '@openedx/paragon';
import FilePopoverContent from 'components/FilePopoverContent';
import FileInfo from './FileInfo';

View File

@@ -1,4 +1,4 @@
@import "@edx/paragon/scss/core/core";
@import "@openedx/paragon/scss/core/core";
.file-card {
margin: map-get($spacers, 1) 0;

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { Collapsible } from '@edx/paragon';
import { Collapsible } from '@openedx/paragon';
import FilePopoverContent from 'components/FilePopoverContent';
import FileInfo from './FileInfo';

View File

@@ -5,8 +5,8 @@ import {
Button,
OverlayTrigger,
Popover,
} from '@edx/paragon';
import { InfoOutline } from '@edx/paragon/icons';
} from '@openedx/paragon';
import { InfoOutline } from '@openedx/paragon/icons';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { nullMethod } from 'hooks';
import messages from './messages';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { Popover } from '@edx/paragon';
import { Popover } from '@openedx/paragon';
import FileInfo from './FileInfo';

View File

@@ -6,8 +6,8 @@ import {
Popover,
Icon,
IconButton,
} from '@edx/paragon';
import { InfoOutline } from '@edx/paragon/icons';
} from '@openedx/paragon';
import { InfoOutline } from '@openedx/paragon/icons';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { nullMethod } from 'hooks';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Spinner } from '@edx/paragon';
import { Spinner } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
/**

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Badge } from '@edx/paragon';
import { Badge } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { StrictDict } from 'utils';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { PageBanner, Hyperlink } from '@edx/paragon';
import { PageBanner, Hyperlink } from '@openedx/paragon';
import messages from './messages';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Form } from '@edx/paragon';
import { Form } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { feedbackRequirement } from 'data/services/lms/constants';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Form } from '@edx/paragon';
import { Form } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { actions, selectors } from 'data/redux';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Form, FormControlFeedback } from '@edx/paragon';
import { Form, FormControlFeedback } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { selectors } from 'data/redux';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Form } from '@edx/paragon';
import { Form } from '@openedx/paragon';
import { selectors } from 'data/redux';
import { gradeStatuses } from 'data/services/lms/constants';

View File

@@ -3,8 +3,8 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { Alert } from '@edx/paragon';
import { Info } from '@edx/paragon/icons';
import { Alert } from '@openedx/paragon';
import { Info } from '@openedx/paragon/icons';
import { selectors } from 'data/redux';
import messages from './messages';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { Hyperlink, Button } from '@edx/paragon';
import { Hyperlink, Button } from '@openedx/paragon';
import urls from 'data/services/lms/urls';
import emptyStateSVG from './assets/empty-state.svg';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { Hyperlink } from '@edx/paragon';
import { Hyperlink } from '@openedx/paragon';
import urls from 'data/services/lms/urls';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button, DataTableContext } from '@edx/paragon';
import { Button, DataTableContext } from '@openedx/paragon';
import * as module from './FilterStatusComponent';

View File

@@ -6,8 +6,8 @@ import {
Alert,
Button,
Hyperlink,
} from '@edx/paragon';
import { Info } from '@edx/paragon/icons';
} from '@openedx/paragon';
import { Info } from '@openedx/paragon/icons';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import urls from 'data/services/lms/urls';

View File

@@ -1,4 +1,4 @@
@import "@edx/paragon/scss/core/core";
@import "@openedx/paragon/scss/core/core";
span.pgn__icon.breadcrumb-arrow {
width: 16px !important;

View File

@@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { ArrowBack, Launch } from '@edx/paragon/icons';
import { Hyperlink, Icon } from '@edx/paragon';
import { ArrowBack, Launch } from '@openedx/paragon/icons';
import { Hyperlink, Icon } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { selectors } from 'data/redux';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { Hyperlink } from '@edx/paragon';
import { Hyperlink } from '@openedx/paragon';
import * as constants from 'data/constants/app';
import urls from 'data/services/lms/urls';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from '@edx/paragon';
import { Button } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

View File

@@ -7,7 +7,7 @@ import {
DataTable,
TextFilter,
MultiSelectDropdownFilter,
} from '@edx/paragon';
} from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { gradingStatuses, submissionFields } from 'data/services/lms/constants';

View File

@@ -4,7 +4,7 @@ import { shallow } from '@edx/react-unit-test-utils';
import {
MultiSelectDropdownFilter,
TextFilter,
} from '@edx/paragon';
} from '@openedx/paragon';
import { selectors, thunkActions } from 'data/redux';
import { gradingStatuses as statuses, submissionFields } from 'data/services/lms/constants';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from '@edx/paragon';
import { Button } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Container, Spinner } from '@edx/paragon';
import { Container, Spinner } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { selectors, thunkActions } from 'data/redux';

View File

@@ -34,7 +34,7 @@ jest.mock('data/redux', () => ({
},
}));
jest.mock('@edx/paragon', () => ({
jest.mock('@openedx/paragon', () => ({
Container: 'Container',
Spinner: 'Spinner',
}));

View File

@@ -6,7 +6,7 @@ import { FormattedMessage } from '@edx/frontend-platform/i18n';
import {
StatefulButton,
Icon,
} from '@edx/paragon';
} from '@openedx/paragon';
import { RequestKeys, RequestStates } from 'data/constants/requests';
import { selectors, thunkActions } from 'data/redux';

View File

@@ -1,4 +1,4 @@
@import "@edx/paragon/scss/core/core";
@import "@openedx/paragon/scss/core/core";
.response-display {
padding: map-get($spacers, 0);

View File

@@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import {
Card, Collapsible, Icon, DataTable, Button,
} from '@edx/paragon';
import { ArrowDropDown, ArrowDropUp, WarningFilled } from '@edx/paragon/icons';
} from '@openedx/paragon';
import { ArrowDropDown, ArrowDropUp, WarningFilled } from '@openedx/paragon/icons';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { downloadAllLimit, downloadSingleLimit } from 'data/constants/files';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Card } from '@edx/paragon';
import { Card } from '@openedx/paragon';
import createDOMPurify from 'dompurify';

View File

@@ -1,4 +1,4 @@
@import "@edx/paragon/scss/core/core";
@import "@openedx/paragon/scss/core/core";
// action reviews
.review-actions {

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { useSelector } from 'react-redux';
import { Cancel, Highlight } from '@edx/paragon/icons';
import { Cancel, Highlight } from '@openedx/paragon/icons';
import { selectors, thunkActions } from 'data/redux';
import { RequestKeys } from 'data/constants/requests';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { Button } from '@edx/paragon';
import { Button } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import StopGradingConfirmModal from '../StopGradingConfirmModal';

View File

@@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Icon, IconButton } from '@edx/paragon';
import { ChevronLeft, ChevronRight } from '@edx/paragon/icons';
import { Icon, IconButton } from '@openedx/paragon';
import { ChevronLeft, ChevronRight } from '@openedx/paragon/icons';
import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { selectors, thunkActions } from 'data/redux';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { ActionRow, Button } from '@edx/paragon';
import { ActionRow, Button } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { actions, selectors } from 'data/redux';

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Col, Row } from '@edx/paragon';
import { Col, Row } from '@openedx/paragon';
import { selectors } from 'data/redux';
import { RequestKeys } from 'data/constants/requests';

View File

@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button } from '@edx/paragon';
import { Info } from '@edx/paragon/icons';
import { Alert, Button } from '@openedx/paragon';
import { Info } from '@openedx/paragon/icons';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
const messageShape = PropTypes.shape({

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { Button } from '@edx/paragon';
import { Button } from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import ReviewError from './ReviewError';

View File

@@ -1,4 +1,4 @@
@import "@edx/paragon/scss/core/core";
@import "@openedx/paragon/scss/core/core";
.review-modal-body {
background-color: $gray-300 !important;

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { FullscreenModal } from '@edx/paragon';
import { FullscreenModal } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import LoadingMessage from 'components/LoadingMessage';

View File

@@ -1,5 +1,5 @@
@import "~@edx/brand/paragon/variables";
@import "~@edx/paragon/scss/core/core";
@import "~@openedx/paragon/scss/core/core";
@import "~@edx/brand/paragon/overrides";
.criteria-label {

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Form } from '@edx/paragon';
import { Form } from '@openedx/paragon';
import {
FormattedMessage,
injectIntl,

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { Card, StatefulButton } from '@edx/paragon';
import { Card, StatefulButton } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import DemoAlert from 'components/DemoAlert';

View File

@@ -1,6 +1,6 @@
import { messages as footerMessages } from '@edx/frontend-component-footer';
import { messages as headerMessages } from '@edx/frontend-component-header';
import { messages as paragonMessages } from '@edx/paragon';
import { messages as paragonMessages } from '@openedx/paragon';
import arMessages from './messages/ar.json';
import deDEMessages from './messages/de_DE.json';

View File

@@ -29,7 +29,7 @@ jest.mock('@edx/frontend-platform/i18n', () => {
};
});
jest.mock('@edx/paragon', () => jest.requireActual('testUtils').mockNestedComponents({
jest.mock('@openedx/paragon', () => jest.requireActual('testUtils').mockNestedComponents({
Alert: {
Heading: 'Alert.Heading',
},
@@ -95,7 +95,7 @@ jest.mock('@fortawesome/free-solid-svg-icons', () => ({
faUserCircle: jest.fn().mockName('fa-user-circle-icon'),
}));
jest.mock('@edx/paragon/icons', () => ({
jest.mock('@openedx/paragon/icons', () => ({
ArrowBack: jest.fn().mockName('icons.ArrowBack'),
ArrowDropDown: jest.fn().mockName('icons.ArrowDropDown'),
ArrowDropUp: jest.fn().mockName('icons.ArrowDropUp'),

View File

@@ -27,8 +27,8 @@ import App from 'App';
import Inspector from './inspector';
import appMessages from './messages';
jest.unmock('@edx/paragon');
jest.unmock('@edx/paragon/icons');
jest.unmock('@openedx/paragon');
jest.unmock('@openedx/paragon/icons');
jest.unmock('@edx/frontend-platform/i18n');
jest.unmock('react');
jest.unmock('react-redux');

View File

@@ -1,5 +1,5 @@
const path = require('path');
const { createConfig } = require('@edx/frontend-build');
const { createConfig } = require('@openedx/frontend-build');
const config = createConfig('webpack-dev');

View File

@@ -1,5 +1,5 @@
const path = require('path');
const { createConfig } = require('@edx/frontend-build');
const { createConfig } = require('@openedx/frontend-build');
const config = createConfig('webpack-prod');