Skip to content

Commit f4fc43b

Browse files
authored
chore(RHINENG-7042): adopt fec-config (#1178)
* chore(RHINENG-7042): adopt fec-config * chore(RHINENG-7042): use proper fed-module export path, return entry files * chore(RHINENG-7042): further remove obsolete npm scripts, cleanup travis config * chore: permissive requiredVersion and remove interceptChromeConfig in fec.config * chore: update package-lock
1 parent 21e72f2 commit f4fc43b

16 files changed

Lines changed: 34223 additions & 5869 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ coverage
2121

2222
codecov*
2323
.nyc_output/
24-
reports/
24+
reports/
25+
26+
.cache/

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ jobs:
1515
script: npm run lint
1616
- stage: Test
1717
script: npm run test && npm run test:ct && npm run coverage
18-
- stage: Deploy
19-
script: npm run deploy && curl -sSL https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master/src/bootstrap.sh | bash -s
20-
- stage: Build components and release
21-
script: rm -rf dist ; npm run build:components ; npm run semantic-release
18+
- stage: Tag release
19+
script: npm run semantic-release
2220
env:
2321
global:
2422
- REPO="git@github.com:RedHatInsights/patchman-ui-build"

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@ Note: You will need to set up the Insights environment if you want to develop wi
3535

3636
2. ```npm install```
3737

38-
3. ```SPANDX_CONFIG="./config/spandx.config.js" bash $PROXY_PATH/scripts/run.sh```
39-
- If you are using insights proxy, it is time to start it. Otherwise you can skip this step
40-
41-
4. ```npm run start```
38+
3. ```npm run start:proxy```
4239
- use this command if you want to develop Patch UI using insights proxy. The command starts webpack bundler and serves the files with webpack dev server
43-
44-
```npm run start:proxy:beta```
45-
- use this command if you wand to develop Patch UI using webpack proxy starts webpack bundler and serves the files with webpack dev server
40+
- While you run the command above, you will be prompted to choose an enviroment.
41+
42+
Open browser with the URL generated by the webpack dev server your terminal
4643

4744
### Testing
4845

babel.config.js

Lines changed: 5 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,9 @@
1-
/* global module, __dirname, require */
2-
require.extensions['.css'] = () => undefined;
3-
const path = require('path');
4-
const glob = require('glob');
5-
6-
/**
7-
* We require a mapper for some PF modules because the modle export names do not match their location
8-
*/
9-
const mapper = {
10-
TextVariants: 'Text',
11-
EmptyStateVariant: 'EmptyState',
12-
PaginationVariant: 'Pagination',
13-
SelectVariant: 'selectConstants',
14-
DropdownPosition: 'dropdownConstants',
15-
TextListVariants: 'TextList',
16-
TextListItemVariants: 'TextListItem',
17-
ClipboardCopyVariant: 'ClipboardCopy',
18-
TooltipPosition: 'Tooltip'
19-
};
20-
21-
const IconMapper = {
22-
AnsibeTowerIcon: 'ansibeTower-icon'
23-
};
24-
25-
const FECMapper = {
26-
SkeletonSize: 'Skeleton',
27-
PageHeaderTitle: 'PageHeader',
28-
conditionalFilterType: 'ConditionalFilter'
29-
};
30-
31-
const NotificationMapper = {
32-
REMOVE_NOTIFICATION: 'actionTypes',
33-
ADD_NOTIFICATION: 'actionTypes',
34-
NotificationsPortal: 'NotificationPortal',
35-
addNotification: 'actions'
36-
};
37-
38-
/**
39-
* These two plugins will replace all replative imports with absolute import paths to the commonJS version of asset
40-
* PF esm build is broken, it points to commonJS files internaly
41-
* There fore its better to use commonJS version of the build to avoid duplicate cjs/esm variants of components
42-
* After its fixed in PF we can swap to using esm build
43-
*/
44-
const patternflyTransformImports = (env) => [
45-
'transform-imports',
46-
{
47-
'@patternfly/react-table': {
48-
skipDefaultConversion: true,
49-
transform: `@patternfly/react-table/dist/${env}`
50-
},
51-
'@patternfly/react-core': {
52-
transform: (importName) => {
53-
let res;
54-
const files = glob.sync(
55-
path.resolve(
56-
__dirname,
57-
`./node_modules/@patternfly/react-core/dist/${env}/**/${mapper[
58-
importName
59-
] || importName}.js`
60-
)
61-
);
62-
if (files.length > 0) {
63-
res = files[0];
64-
} else {
65-
throw `File with importName ${importName} does not exist`;
66-
}
67-
68-
res = res.replace(path.resolve(__dirname, './node_modules/'), '');
69-
res = res.replace(/^\//, '');
70-
return res;
71-
},
72-
preventFullImport: true,
73-
skipDefaultConversion: true
74-
},
75-
'@patternfly/react-icons': {
76-
transform: (importName) =>
77-
`@patternfly/react-icons/dist/${env}/icons/${IconMapper[importName] || importName
78-
.split(/(?=[A-Z])/)
79-
.join('-')
80-
.toLowerCase()}.js`,
81-
preventFullImport: true
82-
}
83-
},
84-
'patternfly-react'
85-
];
86-
87-
const fecTransformImports = (env) => [
88-
'transform-imports',
89-
{
90-
'@redhat-cloud-services/frontend-components': {
91-
transform: (importName) => `@redhat-cloud-services/frontend-components/components/${
92-
env
93-
}/${
94-
FECMapper[importName] || importName
95-
}.js`,
96-
preventFullImport: false,
97-
skipDefaultConversion: true
98-
},
99-
'@redhat-cloud-services/frontend-components-notifications': {
100-
transform: (importName) =>
101-
`@redhat-cloud-services/frontend-components-notifications/${
102-
env
103-
}/${
104-
NotificationMapper[importName] || importName
105-
}.js`,
106-
preventFullImport: true
107-
}
108-
},
109-
'frontend-components'
110-
];
111-
1121
module.exports = {
113-
presets: ['@babel/env', '@babel/react', '@babel/flow'],
2+
presets: [
3+
'@babel/env',
4+
'@babel/react',
5+
'@babel/flow'
6+
],
1147
plugins: [
1158
['transform-inline-environment-variables', {
1169
include: [
@@ -124,24 +17,6 @@ module.exports = {
12417
'@babel/plugin-proposal-class-properties'
12518
],
12619
env: {
127-
esm: {
128-
plugins: [
129-
patternflyTransformImports('esm'),
130-
fecTransformImports('esm')
131-
]
132-
},
133-
production: {
134-
plugins: [
135-
patternflyTransformImports('esm'),
136-
fecTransformImports('esm')
137-
]
138-
},
139-
development: {
140-
plugins: [
141-
patternflyTransformImports('esm'),
142-
fecTransformImports('esm')
143-
]
144-
},
14520
componentTest: {
14621
plugins: [
14722
'istanbul'

config/dev.webpack.config.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

config/prod.webpack.config.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

config/rollup.config.js

Lines changed: 0 additions & 112 deletions
This file was deleted.

config/spandx.config.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)