|
1 |
| -# taasapp |
2 |
| -TaaS App Front End |
| 1 | +# Topcoder Teams Microapp |
| 2 | + |
| 3 | +This is a [single-spa](https://single-spa.js.org/) example React microapp. |
| 4 | + |
| 5 | +> NOTE. This application have been configured to be run as child app of a single-spa application. So while this app can be deployed and run independently, we would need some frame [single-spa](https://single-spa.js.org/) which would load it. While technically we can achieve running this app as standalone app it's strongly not recommended by the author of the `single-spa` approch, see this [GitHub Issue](https://github.com/single-spa/single-spa/issues/640) for details. |
| 6 | +
|
| 7 | +## Requirements |
| 8 | + |
| 9 | +- node - v10.22.1 |
| 10 | +- npm - v6.14.6 |
| 11 | + |
| 12 | +## Technology Stack |
| 13 | + |
| 14 | +- React 16.12 |
| 15 | +- Router via [Reach Router](https://reach.tech/router/) |
| 16 | +- CSS Modules with SCSS via [babel-plugin-react-css-modules](https://github.com/gajus/babel-plugin-react-css-modules) |
| 17 | +- [React Inline SVG](https://github.com/airbnb/babel-plugin-inline-react-svg) |
| 18 | + |
| 19 | +## Config |
| 20 | + |
| 21 | +For available variables config, please refer to `config/development.js` and `config/production.js`. |
| 22 | + |
| 23 | +## NPM Commands |
| 24 | + |
| 25 | +| Command | Description | |
| 26 | +| --------------------- | ----------------------------------------------------------------- | |
| 27 | +| `npm start` | Run server which serves production ready build from `dist` folder | |
| 28 | +| `npm run dev` | Run app in the development mode | |
| 29 | +| `npm run dev-https` | Run app in the development mode using HTTPS protocol | |
| 30 | +| `npm run build` | Build app for production and puts files to the `dist` folder | |
| 31 | +| `npm run analyze` | Analyze dependencies sizes and opens report in the browser | |
| 32 | +| `npm run lint` | Check code for lint errors | |
| 33 | +| `npm run format` | Format code using prettier | |
| 34 | +| `npm run test` | Run unit tests | |
| 35 | +| `npm run watch-tests` | Watch for file changes and run unit tests on changes | |
| 36 | +| `npm run coverage` | Generate test code coverage report | |
| 37 | + |
| 38 | +## Local Deployment |
| 39 | + |
| 40 | +Inside the project folder run: |
| 41 | + |
| 42 | +- `npm i` - install dependencies |
| 43 | +- `npm run dev` - run app in development mode |
| 44 | +- As this app can be loaded only inside a frame single-spa, you have to run a `micro-frontends-frame` frame app and configure it to use the URL `http://localhost:8501/topcoder-micro-frontends-teams.js`. |
| 45 | + |
| 46 | +## Deployment to Production |
| 47 | + |
| 48 | +- `npm i` - install dependencies |
| 49 | +- `npm build` - build code to `dist/` folder |
| 50 | +- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`. |
| 51 | + |
| 52 | +### Deploying to Heroku |
| 53 | + |
| 54 | +Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli) installed and you have a Heroku account. And then inside the project folder run the next commands: |
| 55 | + |
| 56 | +- If there is not Git repository inited yet, create a repo and commit all the files: |
| 57 | + - `git init` |
| 58 | + - `git add .` |
| 59 | + - `git commit -m'inital commit'` |
| 60 | +- `heroku apps:create` - create Heroku app |
| 61 | +- `git push heroku master` - push changes to Heroku and trigger deploying |
| 62 | +- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-micro-frontends-teams.js` to load this microapp. |
0 commit comments