📚 how to switch from create-react-app-buildpack

This commit is contained in:
Mars Hall
2017-03-10 10:54:50 -08:00
committed by GitHub
parent e9f8b39a3a
commit 1f81f8ff96

View File

@@ -5,6 +5,8 @@ A minimal example of using a Node backend (server for API, proxy, & routing) wit
To deploy a frontend-only React app, use the static-site optimized
▶️ [create-react-app-buildpack](https://github.com/mars/create-react-app-buildpack)
⤵️ [Switching from create-react-app-buildpack](#switching-from-create-react-app-buildpack)?
## Design Points
@@ -44,6 +46,31 @@ This deployment will automatically:
👓 More about [deploying to Heroku](https://devcenter.heroku.com/categories/deployment).
## Switching from create-react-app-buildpack
If an app was previously deployed with [create-react-app-buildpack](https://github.com/mars/create-react-app-buildpack), then a few steps are required to migrate the app to this architecture:
1. Remove **create-react-app-buildpack** from the app; [heroku/nodejs buildpack](https://devcenter.heroku.com/articles/nodejs-support#activation) will be automatically activated
```bash
heroku buildpacks:clear
```
1. Move the root React app files (including dotfiles) into a `react-ui/` subdirectory
```bash
mkdir react-ui
mv * .[!.]* react-ui/
```
1. Create a root [`package.json`](package.json) and [`server/`](server/) modeled after the code in this repo
1. Commit and deploy ♻️
```bash
git add -A
git commit -m 'Migrate from create-react-app-buildpack to Node server'
git push heroku master
```
## Local Development
### Run the API Server