single-spa demo - Nav
Overview
This repo is used in conjunction with three other repos listed below. Together they make up an application composed of microfrontends. Each app can be updated and deployed independently of the others.
- Root Config (https://github.com/thawkin3/single-spa-demo-root-config)
- Nav App (This Repo) (https://github.com/thawkin3/single-spa-demo-nav)
- Page App 1 (https://github.com/thawkin3/single-spa-demo-page-1)
- Page App 2 (https://github.com/thawkin3/single-spa-demo-page-2)
Demo
You can find the demo here: https://thawkin3-single-spa-demo.herokuapp.com/page1
How It Works
This project uses single-spa to architect an app composed of micrfrontends. In the root config, the three microfrontend apps (nav, page 1, and page 2) are registered with singe-spa. The main index.ejs
file contains an import map, which references where to find the compiled JavaScript bundle for each microfrontend. SystemJS is the module loader which then loads the bundles when needed.
Each repo is set up with Travis CI for running jobs as part of a continuous integration pipeline. When new code is pushed to the master branch for any of the repos, the new code is compiled and then uploaded to AWS S3, which serves as a CDN. The CI job also updates the import map file to reference the new bundle for the updated project.
NPM Scripts
analyze
: Analyzes the makeup of the app bundlebuild
: Creates a production buildcoverage
: Runs unit tests and generates a coverage reportlint
: Lints the code using ESLintprettier
: Formats the code using Prettierstart
: Starts a webpack dev server for running the app in development modetest
: Runs unit tests using Jestwatch-tests
: Runs unit tests in "watch" mode