Skip to content

Commit

Permalink
Adds standalone mode for development (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio authored Dec 1, 2023
1 parent 5ea1697 commit 012895d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ the [landing page frontend](https://github.com/RedHatInsights/landing-page-front
or the [scss file](https://github.com/RedHatInsights/landing-page-frontend/blob/master/src/components/app-content-renderer/virtual-assistant.scss)
In the landing page code.

### Standalone mode

A standalone mode is provided to run virtual assistant frontend without the landing page.
This mode won't provide the exact position of the elements as in the landing page, but it can be easier to run.

You still need to complete once the `Initial etc/hosts setup` as detailed in the landing page repository.
After that, you can run `npm run start:standalone`.

If you want to run your backend locally, use `USE_LOCAL_RASA=1 npm run start:standalone`.

### Testing

`npm run verify` will run `npm run lint` (eslint) and `npm test` (Jest)
22 changes: 21 additions & 1 deletion fec.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
const path = require('path');

const extraExposes = {};
const appUrl = [];

if (process.env.STANDALONE === 'true') {
extraExposes['./RootApp'] = path.resolve(__dirname, './src/SharedComponents/AstroVirtualAssistant/AstroVirtualAssistant.tsx');
appUrl.push('/staging/virtual-assistant');
}

const getRoutes = () => {
if (process.env.USE_LOCAL_RASA && process.env.USE_LOCAL_RASA !== '') {
return {
'/api/virtual-assistant/v1': { host: 'http://localhost:5005' },
};
}

return undefined;
};

module.exports = {
appUrl: [],
appUrl: appUrl,
debug: true,
useProxy: true,
proxyVerbose: true,
routes: getRoutes(),
interceptChromeConfig: true,
moduleFederation: {
exposes: {
'./AstroVirtualAssistant': path.resolve(__dirname, './src/SharedComponents/AstroVirtualAssistant/AstroVirtualAssistant.tsx'),
...extraExposes,
},
},
plugins: [],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lint:sass": "stylelint 'src/**/*.scss' --config .stylelintrc.json",
"patch:hosts": "fec patch-etc-hosts",
"start": "HOT=true fec static",
"start:standalone": "HOT=true STANDALONE=true fec dev",
"test": "jest",
"postinstall": "rimraf .cache",
"verify": "npm-run-all build lint test"
Expand Down

0 comments on commit 012895d

Please sign in to comment.