Skip to content

Commit

Permalink
update babel.config file
Browse files Browse the repository at this point in the history
  • Loading branch information
adonispuente committed Jun 25, 2024
1 parent 1eeb4c9 commit 3f996b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 89 deletions.
83 changes: 0 additions & 83 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
require.extensions['.css'] = () => undefined;
const path = require('path');
const glob = require('glob');

const mapper = {
TextVariants: 'Text',
DropdownPosition: 'dropdownConstants',
EmptyStateVariant: 'EmptyState',
TextListItemVariants: 'TextListItem',
TextListVariants: 'TextList',
getDefaultOUIAId: 'ouia',
useOUIAProps: 'ouia',
PaginationVariant: 'Pagination',
};

const FECMapper = {
SkeletonSize: 'Skeleton',
PageHeaderTitle: 'PageHeader',
};

const NotificationMapper = {
REMOVE_NOTIFICATION: 'actionTypes',
ADD_NOTIFICATION: 'actionTypes',
NotificationsPortal: 'NotificationPortal/index',
addNotification: 'actions',
};

const IconMapper = {
AnsibeTowerIcon: 'ansibeTower-icon',
ChartSpikeIcon: 'chartSpike-icon',
};

module.exports = {
presets: [
[
Expand All @@ -51,57 +19,6 @@ module.exports = {
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread',
[
'transform-imports',
{
'@redhat-cloud-services/frontend-components-notifications': {
transform: (importName) =>
`@redhat-cloud-services/frontend-components-notifications/${
NotificationMapper[importName] || importName
}.js`,
preventFullImport: true,
},
'@redhat-cloud-services/frontend-components': {
transform: (importName) =>
`@redhat-cloud-services/frontend-components/${
FECMapper[importName] || importName
}`,
preventFullImport: true,
skipDefaultConversion: true,
},
'@patternfly/react-icons': {
transform: (importName) =>
`@patternfly/react-icons/dist/esm/icons/${
IconMapper[importName] ||
importName
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase()
}.js`,
preventFullImport: true,
},
'@patternfly/react-core': {
transform: (importName) => {
const files = glob.sync(
path.resolve(
__dirname,
`./node_modules/@patternfly/react-core/dist/esm/**/${
mapper[importName] || importName
}.js`
)
);
if (files.length > 0) {
return files[0].replace(/.*(?=@patternfly)/, '');
} else {
throw `File with importName ${importName} does not exist`;
}
},
preventFullImport: false,
skipDefaultConversion: true,
},
},
'frontend-notifications',
],
],
env: {
componentTest: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ exports[`GeneralInformation should render correctly 1`] = `
aria-disabled="false"
aria-label="Action for Host name"
class="pf-v5-c-button pf-m-plain ins-active-general_information__popover-icon"
data-ouia-component-id="OUIA-Generated-Button-plain-4"
data-ouia-component-id="OUIA-Generated-Button-plain-6"
data-ouia-component-type="PF5/Button"
data-ouia-safe="true"
type="button"
Expand Down Expand Up @@ -114,7 +114,7 @@ exports[`GeneralInformation should render correctly 1`] = `
aria-disabled="false"
aria-label="Action for Display name"
class="pf-v5-c-button pf-m-plain ins-active-general_information__popover-icon"
data-ouia-component-id="OUIA-Generated-Button-plain-5"
data-ouia-component-id="OUIA-Generated-Button-plain-7"
data-ouia-component-type="PF5/Button"
data-ouia-safe="true"
type="button"
Expand Down Expand Up @@ -179,7 +179,7 @@ exports[`GeneralInformation should render correctly 1`] = `
aria-disabled="false"
aria-label="Action for Ansible hostname"
class="pf-v5-c-button pf-m-plain ins-active-general_information__popover-icon"
data-ouia-component-id="OUIA-Generated-Button-plain-6"
data-ouia-component-id="OUIA-Generated-Button-plain-8"
data-ouia-component-type="PF5/Button"
data-ouia-safe="true"
type="button"
Expand Down Expand Up @@ -707,7 +707,7 @@ exports[`GeneralInformation should render correctly 1`] = `
aria-label="Details"
aria-labelledby="simple-node0 expand-toggle0"
class="pf-v5-c-button pf-m-plain"
data-ouia-component-id="OUIA-Generated-Button-plain-3"
data-ouia-component-id="OUIA-Generated-Button-plain-9"
data-ouia-component-type="PF5/Button"
data-ouia-safe="true"
id="expand-toggle0"
Expand Down Expand Up @@ -812,7 +812,7 @@ exports[`GeneralInformation should render correctly 1`] = `
aria-label="Details"
aria-labelledby="simple-node1 expand-toggle1"
class="pf-v5-c-button pf-m-plain"
data-ouia-component-id="OUIA-Generated-Button-plain-4"
data-ouia-component-id="OUIA-Generated-Button-plain-10"
data-ouia-component-type="PF5/Button"
data-ouia-safe="true"
id="expand-toggle1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FormSpy, useFormApi } from '@data-driven-forms/react-form-renderer';
import { Button, Flex, Icon } from '@patternfly/react-core';
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon';
import warningColor from '@patternfly/react-tokens/dist/esm/global_warning_color_100';
import { warningColor } from '@patternfly/react-tokens';
import PropTypes from 'prop-types';
import React from 'react';
import Modal from './Modal';
Expand Down

0 comments on commit 3f996b9

Please sign in to comment.