@redhat-cloud-services/frontend-components-config 4.3.9 → 4.4.0

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.
Files changed (3) hide show
  1. package/README.md +104 -0
  2. package/bin/fec.js +40 -0
  3. package/package.json +9 -3
package/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  - [Using provided services](#Using-provided-services)
21
21
  - [Writing services](#Writing-services)
22
22
  - [Customizing default services](#Customizing-default-services)
23
+ - [fec node scripts](#fec-node-scripts)
23
24
 
24
25
 
25
26
  ## Webpack 5
@@ -303,3 +304,106 @@ 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.5.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
+ ```
package/bin/fec.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ const federate = require('@redhat-cloud-services/frontend-components-config-utilities/serve-federated');
4
+ const yargs = require('yargs');
5
+
6
+ const cwd = process.cwd();
7
+
8
+ const argv = yargs
9
+ .usage('Usage: $0 <command> [options]')
10
+ .command('static', 'Serve webpack output without the webpack server', (yargs) => {
11
+ yargs.positional('config', {
12
+ type: 'string',
13
+ alias: 'c',
14
+ describe: 'Path to webpack config'
15
+ }).positional('port', {
16
+ type: 'number',
17
+ alias: 'p',
18
+ describe: 'Asset server port',
19
+ default: 8003
20
+ });
21
+ })
22
+ .help()
23
+ .argv;
24
+
25
+ const scripts = {
26
+ federate
27
+ };
28
+
29
+ const args = [ argv, cwd ];
30
+
31
+ function run() {
32
+ if (!argv._.length || argv._.length === 0) {
33
+ console.error('Script name name must be specified. Run fec --help for more information.');
34
+ process.exit(1);
35
+ }
36
+
37
+ scripts[argv._[0]](...args);
38
+ }
39
+
40
+ run();
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/frontend-components-config",
3
- "version": "4.3.9",
3
+ "version": "4.4.0",
4
4
  "description": "Config plugins and settings for RedHat Cloud Services project.",
5
5
  "main": "index.js",
6
+ "bin": {
7
+ "fec": "bin/fec.js"
8
+ },
6
9
  "publishConfig": {
7
10
  "access": "public"
8
11
  },
@@ -17,18 +20,20 @@
17
20
  },
18
21
  "homepage": "https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#readme",
19
22
  "dependencies": {
20
- "@redhat-cloud-services/frontend-components-config-utilities": "^1.4.16",
23
+ "@redhat-cloud-services/frontend-components-config-utilities": "^1.4.17",
21
24
  "assert": "^2.0.0",
22
25
  "babel-loader": "^8.2.2",
23
26
  "browserify-zlib": "^0.2.0",
24
27
  "buffer": "^6.0.3",
25
28
  "clean-webpack-plugin": "^3.0.0",
26
29
  "css-loader": "^5.2.6",
30
+ "concurrently": "^6.3.0",
27
31
  "git-revision-webpack-plugin": "^3.0.6",
28
32
  "glob": "^7.0.0",
29
33
  "html-replace-webpack-plugin": "^2.6.0",
30
34
  "html-webpack-plugin": "^5.3.1",
31
35
  "https-proxy-agent": "^5.0.0",
36
+ "http-server": "^13.0.2",
32
37
  "mini-css-extract-plugin": "^1.6.0",
33
38
  "js-yaml": "^4.0.0",
34
39
  "jws": "^4.0.0",
@@ -44,6 +49,7 @@
44
49
  "webpack": "^5.55.1",
45
50
  "webpack-cli": "^4.8.0",
46
51
  "webpack-dev-server": "^4.3.0",
47
- "write-file-webpack-plugin": "^4.5.1"
52
+ "write-file-webpack-plugin": "^4.5.1",
53
+ "yargs": "^17.2.1"
48
54
  }
49
55
  }