Switch to Heroku Node.js auto-build
This commit is contained in:
@@ -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
|
* [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)
|
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)
|
* 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)
|
* deployed via `build` script in the Node server's [`./package.json`](package.json)
|
||||||
* module cache configured by `cacheDirectories`
|
* module cache configured by `cacheDirectories`
|
||||||
* bundling via `heroku-postbuild` hook
|
|
||||||
|
|
||||||
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.
|
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)
|
* detect [Node buildpack](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nodejs)
|
||||||
* build the app with
|
* build the app with
|
||||||
* `npm install` for the Node server
|
* `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`
|
* launch the web process with `npm start`
|
||||||
* serves `../react-ui/build/` as static files
|
* serves `../react-ui/build/` as static files
|
||||||
* customize by adding API, proxy, or route handlers/redirectors
|
* customize by adding API, proxy, or route handlers/redirectors
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "heroku-cra-node",
|
"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",
|
"description": "How to use create-react-app with a custom Node API on Heroku",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "10.x"
|
"node": "10.x"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server",
|
"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": [
|
"cacheDirectories": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Reference in New Issue
Block a user