React App on GitHub Pages
Recently I came across the idea of publishing a React App on GitHub Pages. I can distribute my React App using GitHub, further saving server bandwidth and simplifying the API server structure. I have created a boilerplate for this structure.
- GitHub has a feature that automatically posts the
docsfolder into a small landing page.
- Create-React-App builds its results into a
- So if I can automatically move files from
/docswhenever I build the app, it would work as if I have set up a CI/CD structure.
"start": "react-scripts start",
"build": "react-scripts build && rm -rf docs && mv build docs",
"test": "react-scripts test --verbose",
"eject": "react-scripts eject"
yarn build command will replace the docs folder with a newer build of the app.