Switch to Heroku Node.js auto-build

This commit is contained in:
Mars Hall
2019-04-01 15:30:25 -07:00
parent 440b1b2d29
commit 09e155d625
2 changed files with 5 additions and 6 deletions

View File

@@ -16,9 +16,8 @@ A combo of two npm projects, the backend server and the frontend UI. So there ar
* [deployed automatically](https://devcenter.heroku.com/categories/deployment) via heroku/nodejs buildpack
2. [**React UI**](react-ui/): [`react-ui/package.json`](react-ui/package.json)
* generated by [create-react-app](https://github.com/facebookincubator/create-react-app)
* deployed via build hooks in the Node server's [`./package.json`](package.json)
* module cache configured by `cacheDirectories`
* bundling via `heroku-postbuild` hook
* deployed via `build` script in the Node server's [`./package.json`](package.json)
* module cache configured by `cacheDirectories`
Includes a minimal [Node Cluster](https://nodejs.org/docs/latest-v8.x/api/cluster.html) [implementation](server/index.js) to parallelize the single-threaded Node process across the available CPU cores.
@@ -41,7 +40,7 @@ This deployment will automatically:
* detect [Node buildpack](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nodejs)
* build the app with
* `npm install` for the Node server
* `heroku-postbuild` for create-react-app
* `npm run build` for create-react-app
* launch the web process with `npm start`
* serves `../react-ui/build/` as static files
* customize by adding API, proxy, or route handlers/redirectors

View File

@@ -1,13 +1,13 @@
{
"name": "heroku-cra-node",
"version": "1.0.0",
"version": "2.0.0",
"description": "How to use create-react-app with a custom Node API on Heroku",
"engines": {
"node": "10.x"
},
"scripts": {
"start": "node server",
"heroku-postbuild": "cd react-ui/ && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
"build": "cd react-ui/ && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
},
"cacheDirectories": [
"node_modules",