@redhat-cloud-services/frontend-components-config 4.4.0-beta.2 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -1
- package/bin/fec.js +3 -3
- package/package.json +2 -2
- package/src/config.js +4 -4
- package/src/config.test.js +4 -2
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
- [Using provided services](#Using-provided-services)
|
|
21
21
|
- [Writing services](#Writing-services)
|
|
22
22
|
- [Customizing default services](#Customizing-default-services)
|
|
23
|
-
|
|
23
|
+
- [fec node scripts](#fec-node-scripts)
|
|
24
|
+
- [include PF css modules in your bundle](#include-PF-css-modules-in-your-bundle)
|
|
24
25
|
|
|
25
26
|
## Webpack 5
|
|
26
27
|
|
|
@@ -303,3 +304,123 @@ const { config: webpackConfig, plugins } = config({
|
|
|
303
304
|
standalone: defaultServices
|
|
304
305
|
});
|
|
305
306
|
```
|
|
307
|
+
|
|
308
|
+
# fec node scripts
|
|
309
|
+
|
|
310
|
+
Executable nodejs scripts available after installing RedHat Cloud Services frontend components - webpack config
|
|
311
|
+
|
|
312
|
+
## Usage
|
|
313
|
+
|
|
314
|
+
Use binary in your `package.json` scripts section:
|
|
315
|
+
```js
|
|
316
|
+
{
|
|
317
|
+
"scripts": {
|
|
318
|
+
"script-name": "fec <script-name> [options]"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Static
|
|
324
|
+
|
|
325
|
+
A script that will run webpack build and serve webpack output through `http-serve` server. **This is not supposed to replace webpack dev server!**
|
|
326
|
+
|
|
327
|
+
This script was added due to circular dependency issues when proxying remote containers to another application.
|
|
328
|
+
A remote containers can fail to initialize, which makes local development is impossible.
|
|
329
|
+
|
|
330
|
+
### Inventory example
|
|
331
|
+
|
|
332
|
+
This example will describe a scenario, when we proxy the inventory remote container (for example the inventory table), to compliance UI for local development purposes.
|
|
333
|
+
|
|
334
|
+
### In inventory UI repository changes
|
|
335
|
+
|
|
336
|
+
```diff
|
|
337
|
+
diff --git a/package.json b/package.json
|
|
338
|
+
index f7513bb..d8c9008 100644
|
|
339
|
+
--- a/package.json
|
|
340
|
+
+++ b/package.json
|
|
341
|
+
@@ -69,7 +69,7 @@
|
|
342
|
+
"@babel/preset-env": "^7.15.6",
|
|
343
|
+
"@babel/preset-react": "^7.14.5",
|
|
344
|
+
"@babel/runtime": "^7.15.4",
|
|
345
|
+
- "@redhat-cloud-services/frontend-components-config": "^4.3.9",
|
|
346
|
+
+ "@redhat-cloud-services/frontend-components-config": "^4.4.0",
|
|
347
|
+
"@testing-library/react": "^12.1.0",
|
|
348
|
+
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
|
349
|
+
"abortcontroller-polyfill": "^1.7.3",
|
|
350
|
+
@@ -103,6 +103,7 @@
|
|
351
|
+
"prod": "NODE_ENV=production webpack serve --config config/dev.webpack.config.js",
|
|
352
|
+
"server:ctr": "node src/server/generateServerKey.js",
|
|
353
|
+
"start": "NODE_ENV=development webpack serve --config config/dev.webpack.config.js",
|
|
354
|
+
+ "start:federated": "fec static --config config/dev.webpack.config.js",
|
|
355
|
+
"start:proxy": "PROXY=true NODE_ENV=development webpack serve --config config/dev.webpack.config.js",
|
|
356
|
+
"travis:build": "NODE_ENV=production webpack --config config/prod.webpack.config.js",
|
|
357
|
+
"travis:verify": "npm-run-all travis:build lint test",
|
|
358
|
+
diff --git a/src/components/InventoryTable/NoSystemsTable.js b/src/components/InventoryTable/NoSystemsTable.js
|
|
359
|
+
index 75de937..4fc60ab 100644
|
|
360
|
+
--- a/src/components/InventoryTable/NoSystemsTable.js
|
|
361
|
+
+++ b/src/components/InventoryTable/NoSystemsTable.js
|
|
362
|
+
@@ -10,7 +10,7 @@ const NoSystemsTable = () => (
|
|
363
|
+
<Bullseye>
|
|
364
|
+
<EmptyState variant={ EmptyStateVariant.full }>
|
|
365
|
+
<Title headingLevel="h5" size="lg">
|
|
366
|
+
- No matching systems found
|
|
367
|
+
+ Local change
|
|
368
|
+
</Title>
|
|
369
|
+
<EmptyStateBody>
|
|
370
|
+
This filter criteria matches no systems. <br /> Try changing your filter settings.
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Compliance frontend setup
|
|
375
|
+
|
|
376
|
+
Note: The `routesPath` was removed because it has higher priority than `routes` config. The proxy config could have also changed in `../config/spandx.config.js` file.
|
|
377
|
+
|
|
378
|
+
```diff
|
|
379
|
+
diff --git a/config/dev.webpack.config.js b/config/dev.webpack.config.js
|
|
380
|
+
index 73eb14c..31f6554 100644
|
|
381
|
+
--- a/config/dev.webpack.config.js
|
|
382
|
+
+++ b/config/dev.webpack.config.js
|
|
383
|
+
@@ -32,10 +32,15 @@ const webpackProxy = {
|
|
384
|
+
proxyVerbose: true,
|
|
385
|
+
useCloud: (process.env?.USE_CLOUD === 'true'),
|
|
386
|
+
...useLocalChrome(),
|
|
387
|
+
- routesPath: process.env.ROUTES_PATH || resolve(__dirname, '../config/spandx.config.js'),
|
|
388
|
+
routes: {
|
|
389
|
+
// Additional routes to the spandx config
|
|
390
|
+
// '/beta/config': { host: 'http://localhost:8003' }, // for local CSC config
|
|
391
|
+
+ '/apps/inventory': {
|
|
392
|
+
+ host: "http://localhost:8003"
|
|
393
|
+
+ },
|
|
394
|
+
+ '/beta/apps/inventory': {
|
|
395
|
+
+ host: "http://localhost:8003"
|
|
396
|
+
+ }
|
|
397
|
+
},
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Run servers
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# in the inventory frontend
|
|
406
|
+
BETA=true npm run start:federated
|
|
407
|
+
# in compliance frontend
|
|
408
|
+
BETA=true npm run start:proxy
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
# include PF css modules in your bundle
|
|
412
|
+
|
|
413
|
+
From version >= 4.5.0 the common config has been setup in a way, that PF styles will no longer be included in webpack build output.
|
|
414
|
+
This decision has been made to remove multiple versions of PF styling from the platform and performance improvement. Patternfly styles are now hoste by chrome.
|
|
415
|
+
If for some reason(bugs) you want to include PF CSS in your bundle, please use the following config:
|
|
416
|
+
|
|
417
|
+
```js
|
|
418
|
+
const config = require('@redhat-cloud-services/frontend-components-config');
|
|
419
|
+
|
|
420
|
+
const { config: webpackConfig, plugins } = config({
|
|
421
|
+
rootFolder: resolve(__dirname, '../'),
|
|
422
|
+
bundlePfModules: true,
|
|
423
|
+
...
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
```
|
package/bin/fec.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const static = require('@redhat-cloud-services/frontend-components-config-utilities/serve-federated');
|
|
4
4
|
const yargs = require('yargs');
|
|
5
5
|
|
|
6
6
|
const cwd = process.cwd();
|
|
7
7
|
|
|
8
8
|
const argv = yargs
|
|
9
9
|
.usage('Usage: $0 <command> [options]')
|
|
10
|
-
.command('
|
|
10
|
+
.command('static', 'Serve webpack output without the webpack server', (yargs) => {
|
|
11
11
|
yargs.positional('config', {
|
|
12
12
|
type: 'string',
|
|
13
13
|
alias: 'c',
|
|
@@ -23,7 +23,7 @@ const argv = yargs
|
|
|
23
23
|
.argv;
|
|
24
24
|
|
|
25
25
|
const scripts = {
|
|
26
|
-
|
|
26
|
+
static
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const args = [ argv, cwd ];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-cloud-services/frontend-components-config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Config plugins and settings for RedHat Cloud Services project.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@redhat-cloud-services/frontend-components-config-utilities": "^1.5.
|
|
23
|
+
"@redhat-cloud-services/frontend-components-config-utilities": "^1.5.4",
|
|
24
24
|
"assert": "^2.0.0",
|
|
25
25
|
"babel-loader": "^8.2.2",
|
|
26
26
|
"browserify-zlib": "^0.2.0",
|
package/src/config.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const proxy = require('@redhat-cloud-services/frontend-components-config-utilities/proxy');
|
|
4
4
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
|
+
const searchIgnoredStyles = require('@redhat-cloud-services/frontend-components-config-utilities/search-ignored-styles');
|
|
5
6
|
|
|
6
7
|
module.exports = ({
|
|
7
8
|
port,
|
|
@@ -31,7 +32,8 @@ module.exports = ({
|
|
|
31
32
|
useCloud,
|
|
32
33
|
target,
|
|
33
34
|
registry,
|
|
34
|
-
client = {}
|
|
35
|
+
client = {},
|
|
36
|
+
bundlePfModules = false
|
|
35
37
|
} = {}) => {
|
|
36
38
|
const filenameMask = `js/[name]${useFileHash ? '.[chunkhash]' : ''}.js`;
|
|
37
39
|
if (betaEnv) {
|
|
@@ -143,9 +145,7 @@ module.exports = ({
|
|
|
143
145
|
resolve: {
|
|
144
146
|
extensions: [ '.ts', '.tsx', '.mjs', '.js', '.scss' ],
|
|
145
147
|
alias: {
|
|
146
|
-
|
|
147
|
-
PFReactCore: '@patternfly/react-core',
|
|
148
|
-
PFReactTable: '@patternfly/react-table'
|
|
148
|
+
...(bundlePfModules ? {} : searchIgnoredStyles(rootFolder))
|
|
149
149
|
},
|
|
150
150
|
fallback: {
|
|
151
151
|
path: require.resolve('path-browserify'),
|
package/src/config.test.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
appEntry,
|
|
5
5
|
rootFolder,
|
|
6
6
|
https*/
|
|
7
|
-
import
|
|
7
|
+
import config from './config';
|
|
8
|
+
|
|
9
|
+
const configBuilder = (c) => config({ rootFolder: '', ...c });
|
|
8
10
|
|
|
9
11
|
describe('should create dummy config with no options', () => {
|
|
10
12
|
const {
|
|
@@ -13,7 +15,7 @@ describe('should create dummy config with no options', () => {
|
|
|
13
15
|
entry,
|
|
14
16
|
output,
|
|
15
17
|
devServer
|
|
16
|
-
} =
|
|
18
|
+
} = config({ rootFolder: '' });
|
|
17
19
|
|
|
18
20
|
const { mode: prodMode } = configBuilder({ mode: 'production' });
|
|
19
21
|
test('mode', () => {
|