Skip to content

Commit

Permalink
chore: remove obsolete packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Oct 31, 2024
1 parent 5c2fc9f commit 0bdbe52
Show file tree
Hide file tree
Showing 23 changed files with 812 additions and 6,403 deletions.
128 changes: 9 additions & 119 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,120 +1,10 @@
require.extensions['.css'] = () => undefined;
const path = require('path');
const glob = require('glob');

const mapper = {
TextVariants: 'Text',
ButtonVariant: 'Button',
PaginationVariant: 'Pagination',
SelectVariant: 'selectConstants',
EmptyStateVariant: 'EmptyState',
DropdownPosition: 'dropdownConstants',
TextListVariants: 'TextList',
TextListItemVariants: 'TextListItem',
ClipboardCopyVariant: 'ClipboardCopy',
TooltipPosition: 'Tooltip'
};

const iconMapper = {
AnsibeTowerIcon: 'ansibeTower-icon',
ChartSpikeIcon: 'chartSpike-icon',
CloudServerIcon: 'cloudServer-icon'
};

const createPfReactTransform = (env) => [
'transform-imports',
{
'@patternfly/react-core': {
transform: (importName) => {
let res;
const pathname = path.resolve(__dirname, `node_modules/@patternfly/react-core/dist/${env}/**/${mapper[importName] || importName}.js`);
const files = glob.sync(pathname);
if (files.length > 0) {
res = files[0];
} else {
throw new Error(`File with importName ${importName} does not exist. Glob path: ${pathname}`);
}

res = res.split('/node_modules/').pop();
res = res.replace(/^\//, '');
return res;
},
preventFullImport: false,
skipDefaultConversion: true
},
'@patternfly/react-icons': {
transform: (importName) =>
`@patternfly/react-icons/dist/${env}/icons/${iconMapper[importName] || importName
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase()}`,
preventFullImport: true
},
'patternfly-react': {
transform: (importName) => {
let res;
const files = glob.sync(path.resolve(__dirname, `../../node_modules/patternfly-react/dist/${env}/**/${importName}.js`));
if (files.length > 0) {
res = files[0];
} else {
throw new Error(`File with importName ${importName} does not exist`);
}

res = res.split('/node_modules/').pop();
res = res.replace(/^\//, '');
return res;
},
preventFullImport: false,
skipDefaultConversion: false
}
},
`pf-react-${env}`
];

module.exports = {
presets: [
[
'@babel/env',
{
targets: '> 0.25%, not dead'
}
],
'@babel/preset-react'
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true
}
],
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread',
'babel-plugin-lodash',
'@babel/plugin-transform-react-display-name',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining'
],
env: {
cjs: {
presets: [ [ '@babel/preset-env', { modules: 'commonjs' }] ],
plugins: [
'./plugins/transform-scss-plugin',
createPfReactTransform('js')
]
},
esm: {
presets: [ [ '@babel/preset-env', { modules: false }] ],
plugins: [
[
'./plugins/transform-scss-plugin',
{
esm: true
}
],
createPfReactTransform('esm')
]
}
}
};
presets: [
[
'@babel/env',
{
targets: '> 0.25%, not dead'
}
]
]
}
14 changes: 0 additions & 14 deletions config/comment-bot.js

This file was deleted.

3 changes: 0 additions & 3 deletions config/globalSetup.js

This file was deleted.

53 changes: 0 additions & 53 deletions config/push-bot.js

This file was deleted.

134 changes: 0 additions & 134 deletions config/release.js

This file was deleted.

Loading

0 comments on commit 0bdbe52

Please sign in to comment.