Skip to content
Open
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
49 changes: 7 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
# Getting Started with Create React App
# MicroFE Setup

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## To use astro-sso-sdk
Fill config.json client id and env

## Available Scripts
Copy the oicd.user total from Motek and update the client id and env (e.g. oidc.user:https://[env]accounts.thlonline.com:[client_id] to oidc.user:https://testaccounts.thlonline.com:microfe) to match the config.json

In the project directory, you can run:
Copy the templates/callback.html (from astro-app) and set the silentRedirectUri to point to that file (need HtmlWebpackPlugin to set the path)

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
[UPDATED]
There is a chrome extension which copies the oicd token from localhost:5000 to localhost:xxxx. If we have the correct setup logic, then this whole process above can be automated
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"clientId": "microfe",
"env": "test"
}
21 changes: 20 additions & 1 deletion config/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const path = require('path');
const root = path.join(__dirname, '../');

Expand All @@ -10,6 +13,16 @@ module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
sourceMap: true,
}),
new OptimizeCSSAssetsPlugin({}),
],
},
performance: {
hints: false,
maxEntrypointSize: 512000,
Expand All @@ -22,7 +35,13 @@ module.exports = {
new HtmlWebpackPlugin({
favicon: 'public/favicon.ico',
template: 'public/index.html'
})
}),
new HtmlWebpackPlugin({
filename: 'callback.html',
template: path.join(root, 'src/templates/callback.html'),
inject: false,
}),
new CopyWebpackPlugin([{ from: './config.json', to: './config.json' }]),
],
module: {
rules: [
Expand Down
12 changes: 6 additions & 6 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ const config = {
output: {
publicPath: 'auto',
},
devtool: 'source-map',
devServer: {
port: 3000,
port: 3001,
historyApiFallback: true,
headers: {
"Access-Control-Allow-Origin": "*"
}
},
plugins: [
new ModuleFederationPlugin({
name: 'MicroFeChild',
name: 'MicroFETradePartners',
filename: 'remoteEntry.js',
exposes: {
'./App': './src/bootstrap.tsx',
'./Routes': './src/Routes.tsx',
'./Components': './src/exports.tsx',
'./Components': './src/externals/exports.tsx',
},
shared: {
...packageJson.dependencies,
react: { requiredVersion: packageJson.dependencies.react }
react: { singleton: true },
'react-dom': { singleton: true },
}
}),
]
Expand Down
Loading