Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rules:
- id: license-check
pattern: FSL-1.1-MIT
severity: ignore
description: FSL-1.1-MIT (Functional Source License) transitions to MIT after 2 years and is acceptable

# Disable license security warnings for known acceptable licenses
checks:
license:
ignore:
- FSL-1.1-MIT
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ In a separate terminal, run Advisor with proxy enabled and list Inventory:
LOCAL_APPS=inventory:8003~http npm run start:proxy
```

## IOP mode
To run Advisor in IOP mode, follow the [IOP mode instructions](https://github.com/RedHatInsights/frontend-development-proxy#iop-mode) in the frontend-development-proxy repository.

You can start the local IOP proxy with `npm run start:proxy:iop` (requires `IOP_URL` to be set).

## Testing
Travis is used to test the build for this code.
- `npm run test` will run tests.
Expand Down
24 changes: 24 additions & 0 deletions config/patchFederationForIop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-disable no-undef */
/**
* Foreman/IOP hosts provide react in the module federation shared scope but not
* react/jsx-runtime or react-intl. FEC defaults mark these as chromeProvided with
* import: false, so the remote fails with:
* Shared module react/jsx-runtime doesn't exist in shared scope default
* (0 , react_intl__WEBPACK_IMPORTED_MODULE_0__.createIntlCache) is not a function
*
* Remove these from chromeProvided so webpack bundles them in the remote.
*/
const federatedModulesPath = require.resolve(
'@redhat-cloud-services/frontend-components-config-utilities/federated-modules'
);
const federatedModulesUtil = require(federatedModulesPath);
const originalCreateIncludes = federatedModulesUtil.createIncludes;

federatedModulesUtil.createIncludes = (...args) => {
const includes = originalCreateIncludes(...args);
if (includes.chromeProvided) {
delete includes.chromeProvided['react/jsx-runtime'];
delete includes.chromeProvided['react-intl'];
}
return includes;
};
8 changes: 8 additions & 0 deletions custom_routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"/assets/apps/advisor/*": {
"url": "http://host.docker.internal:8003"
},
"/api/insights/*": {
"url": "http://host.docker.internal:8000"
}
}
8 changes: 5 additions & 3 deletions fec.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const { resolve } = require('path');
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');

if (process.env.IOP === 'true') {
require('./config/patchFederationForIop');
}

module.exports = {
appUrl: '/insights/advisor',
...(process.env.IOP === 'true'
? { deployment: 'assets/apps' }
: { publicPath: 'auto' }),
SPAFallback: process.env.IOP !== 'true',
debug: true,
useProxy: process.env.PROXY === 'true',
proxyVerbose: true,
Expand All @@ -30,9 +35,6 @@ module.exports = {
]
: []),
],
output: {
publicPath: 'auto',
},
moduleFederation: {
exclude: ['@unleash/proxy-client-react'],
shared: [
Expand Down
Loading