diff --git a/README.md b/README.md index 09b4ef9..0f856fe 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ This is my "training" repository. I put here every trick that is possible. It do This repo serves as a companion to the [tutorial of the same name, over on Medium](https://medium.com/superhighfives/). +## Heroku deployment + +``` +heroku create +heroku config:set NPM_CONFIG_PRODUCTION=false +heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack.git +heroku buildpacks:add heroku/nodejs +heroku buildpacks:add https://github.com/heroku/heroku-buildpack-static.git +git push heroku react-snap:master -f +heroku ps:scale web=1 +``` + ## Load performance optimization Read more [here](https://github.com/stereobooster/react-snap/blob/master/doc/an-almost-static-stack-optimization.md). diff --git a/package.json b/package.json index ee99331..b55aab6 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,16 @@ "generate-appcache": "node scripts/generate-appcache.js", "aws-deploy": "node scripts/aws-deploy.js", "deploy": "yarn run build && yarn run generate-fb && firebase deploy", - "prettier": "prettier --write {*,scripts/*,src/*}.{js,json,css}" + "prettier": "prettier --write {*,scripts/*,src/*}.{js,json,css}", + "postinstall": "yarn run build" }, "reactSnap": { "cacheAjaxRequests": true, - "inlineCss": true, - "http2PushManifest": true, - "include": ["/shell.html"] + "include": ["/shell.html"], + "puppeteerArgs": ["--no-sandbox", "--disable-setuid-sandbox"] + }, + "engines": { + "node": "8.6.0", + "yarn": "1.3.2" } } diff --git a/static.json b/static.json new file mode 100644 index 0000000..7b69ac2 --- /dev/null +++ b/static.json @@ -0,0 +1,11 @@ +{ + "root": "build/", + "headers": { + "/service-worker.js": { + "Cache-Control": "max-age=0" + }, + "/static/**": { + "Cache-Control": "public, max-age=31536000" + } + } +}