diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fa563f..fc8a87b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ install_dependency: &install_dependency install_deploysuite: &install_deploysuite name: Installation of install_deploysuite. command: | - git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript + git clone --branch v1.4.8 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript cp ./../buildscript/master_deploy.sh . cp ./../buildscript/buildenv.sh . cp ./../buildscript/awsconfiguration.sh . @@ -52,7 +52,7 @@ jobs: environment: DEPLOY_ENV: "DEV" LOGICAL_ENV: "dev" - APPNAME: "micro-frontends-navbar-app" + APPNAME: "mfe-header" steps: *builddeploy_steps "build-prod": @@ -60,7 +60,7 @@ jobs: environment: DEPLOY_ENV: "PROD" LOGICAL_ENV: "prod" - APPNAME: "micro-frontends-navbar-app" + APPNAME: "mfe-header" steps: *builddeploy_steps workflows: diff --git a/README.md b/README.md index 8f0ac81..1f3e180 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Inside the project folder run: - `npm i` - install dependencies - `npm run dev` - run app in development mode -- 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:8080/topcoder-micro-frontends-navbar-app.js`. +- As this app can be loaded only inside a frame single-spa, you have to run a `mfe-core` frame app and configure it to use the URL `http://localhost:8080/topcoder-mfe-header.js`. ## Deployment to Production @@ -53,7 +53,7 @@ Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli - `git commit -m'inital commit'` - `heroku apps:create` - create Heroku app - `git push heroku master` - push changes to Heroku and trigger deploying -- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-micro-frontends-navbar-app.js` to load this microapp. +- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-mfe-header.js` to load this microapp. - NOTE: Authorization would not work because only predefined list of domain allowed by `accounts-app`. ### Cross microfrontend imports @@ -73,7 +73,7 @@ This app exports functions to be imported by other microapps. #### How to export -- To export any function we have to `export` in file [src/topcoder-micro-frontends-navbar-app.js](src/topcoder-micro-frontends-navbar-app.js). +- To export any function we have to `export` in file [src/topcoder-mfe-header.js](src/topcoder-mfe-header.js). - If we want to prepare some function for exporting, the good place to do so is inside [src/utils/exports.js](src/utils/exports.js). - We have to bind actions before exporting. - It's not recommended to export the whole Redux Store to keep only navbar responsible for updating it. It's better to create promises which would return some particular value from the store. @@ -86,15 +86,15 @@ When we want to use methods exported in the navbar microapp in other apps we hav For example see https://github.com/topcoder-platform/micro-frontends-react-app -1. Add `@topcoder/micro-frontends-navbar-app` to `externals` in webpack config: +1. Add `@topcoder/mfe-header` to `externals` in webpack config: ```js externals: { - "@topcoder/micro-frontends-navbar-app": "@topcoder/micro-frontends-navbar-app", + "@topcoder/mfe-header": "@topcoder/mfe-header", }, ``` -2. As `importmaps` only work in browser and don't work in unit test, we have to mock this module in unit tests. For example by creating a file `src/__mocks__/@topcoder/micro-frontends-navbar-app.js` with the content like: +2. As `importmaps` only work in browser and don't work in unit test, we have to mock this module in unit tests. For example by creating a file `src/__mocks__/@topcoder/mfe-header.js` with the content like: ```js module.exports = { login: () => {}, @@ -112,18 +112,18 @@ For example see https://github.com/topcoder-platform/micro-frontends-react-app For example see https://github.com/topcoder-platform/micro-frontends-angular-app -1. Add `@topcoder/micro-frontends-navbar-app` to `externals` in webpack config: +1. Add `@topcoder/mfe-header` to `externals` in webpack config: ```js externals: { - "@topcoder/micro-frontends-navbar-app": "@topcoder/micro-frontends-navbar-app", + "@topcoder/mfe-header": "@topcoder/mfe-header", }, ``` 2. Add type definition in `src/typings.d.ts`: ```js - declare module '@topcoder/micro-frontends-navbar-app' { + declare module '@topcoder/mfe-header' { export const login: any; export const businessLogin: any; export const logout: any; @@ -135,4 +135,4 @@ For example see https://github.com/topcoder-platform/micro-frontends-angular-app } ``` -3. TODO: How to make e2e tests work for Angular? So far they fail with error `Module not found: Error: Can't resolve '@topcoder/micro-frontends-navbar-app'` +3. TODO: How to make e2e tests work for Angular? So far they fail with error `Module not found: Error: Can't resolve '@topcoder/mfe-header'` diff --git a/docker/Dockerfile b/docker/Dockerfile index a06aa8f..89b0309 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,10 +8,10 @@ ENV APPMODE=$APPMODE ENV APPENV=$APPENV # Copy the current directory into the Docker image -COPY . /micro-frontends-navbar-app +COPY . /mfe-header # Set working directory for future use -WORKDIR /micro-frontends-navbar-app +WORKDIR /mfe-header # Install the dependencies from package.json RUN npm install diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e09932a..df6dafc 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,7 +1,7 @@ version: "3" services: - micro-frontends-navbar-app: - image: micro-frontends-navbar-app:latest + mfe-header: + image: mfe-header:latest build: context: ../ dockerfile: docker/Dockerfile diff --git a/package.json b/package.json index 3e61724..7784716 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@topcoder/micro-frontends-navbar-app", + "name": "@topcoder/mfe-header", "scripts": { "start": "node server.js", "dev": "cross-env APPMODE=development webpack-dev-server", diff --git a/src/set-public-path.js b/src/set-public-path.js index 0140378..a47a3ca 100644 --- a/src/set-public-path.js +++ b/src/set-public-path.js @@ -5,4 +5,4 @@ import { setPublicPath } from "systemjs-webpack-interop"; * https://single-spa.js.org/docs/faq/#code-splits */ -setPublicPath("@topcoder/micro-frontends-navbar-app"); +setPublicPath("@topcoder/mfe-header"); diff --git a/src/topcoder-micro-frontends-navbar-app.js b/src/topcoder-mfe-header.js similarity index 100% rename from src/topcoder-micro-frontends-navbar-app.js rename to src/topcoder-mfe-header.js diff --git a/src/utils/exports.js b/src/utils/exports.js index 881efc8..5b2cc26 100644 --- a/src/utils/exports.js +++ b/src/utils/exports.js @@ -1,7 +1,7 @@ /** * Prepare all the methods to be ready for exporting to be used in other micoapps in this file. * - * Additionally, we need to export them in `topcoder-micro-frontends-navbar-app.js`. + * Additionally, we need to export them in `topcoder-mfe-header.js`. */ import _ from "lodash"; import { bindActionCreators } from "redux";