📚 clarifications

This commit is contained in:
Mars Hall
2017-01-31 10:35:09 -08:00
committed by GitHub
parent 0f8d98090a
commit 375b8d6678

View File

@@ -2,28 +2,29 @@
Example app combining a React UI (from [create-react-app](https://github.com/facebookincubator/create-react-app)) with a custom Node/Express server. Example app combining a React UI (from [create-react-app](https://github.com/facebookincubator/create-react-app)) with a custom Node/Express server.
If you simply want to deploy a React app, try [create-react-app-buildpack](https://github.com/mars/create-react-app-buildpack). To simply deploy a React app, try [create-react-app-buildpack](https://github.com/mars/create-react-app-buildpack).
## Design Points ## Design Points
* Node server * [Node server](server/)
* [`package.json`](package.json), at the root * [`package.json`](package.json), at the root
* `postinstall` script performs React app's `npm install` on deploy to Heroku * `postinstall` script performs React app's `npm install` on deploy to Heroku
* `cacheDirectories` includes `react-ui/node_modules/` to speed up subsequent deploys to Heroku * `cacheDirectories` includes `react-ui/node_modules/` to speed up subsequent deploys to Heroku
* serves `../react-ui/build/` as static files * serves `../react-ui/build/` as static files
* `npm` works normally * `npm` works normally
* React app * [React app](react-ui/)
* [`react-ui/package.json`](react-ui/package.json), in a subdirectory * [`react-ui/package.json`](react-ui/package.json), in a subdirectory
* as generated by create-react-app * as generated by create-react-app
* plus the `proxy` config enables dual-process (hot-reloading React UI + Node API) for local development * plus the `proxy` config enables dual-process (hot-reloading React UI + Node API) for local development
* `npm` must be run against the subdirectory * `npm` must be run against the subdirectory
* use the prefix option, `npm start --prefix react-ui`, or * use the prefix option, `npm start --prefix react-ui`, or
* change directories `cd react-ui/` to use `npm` * change directories `cd react-ui/` to use `npm`
* Heroku * [deploy to Heroku](https://devcenter.heroku.com/categories/deployment)
* **heroku/node** buildpack will auto-detect via `package.json` * automatically:
* `npm install` for server & `postinstall` for React UI will automatically run * detects [Node](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nodejs) from `package.json`
* `npm start` will automatically launch * builds with `npm install` for server & `postinstall` for React UI
* launches web process with `npm start`
## Punchline ## Punchline
@@ -70,4 +71,4 @@ npm install --prefix react-ui
# Start the server # Start the server
npm start --prefix react-ui npm start --prefix react-ui
``` ```