From 54a5589e75c41eca3f5619a88c1e2c39ab3a78b5 Mon Sep 17 00:00:00 2001 From: Victor Vlasenko Date: Sat, 20 Jan 2018 14:05:08 +0200 Subject: [PATCH] Improve Yarn caching on Travis CI and Heroku --- .travis.yml | 11 ++++++++++- README.md | 7 +------ package.json | 9 +++++---- tools/webpackAppConfig.js | 3 +++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2f5cece301..59521d0e9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,22 @@ +before_install: + - eval "$(curl -sL https://raw.githubusercontent.com/colesbury/travis-remote-shell/master/run.sh)" language: node_js node_js: - "node" +cache: + directories: + - node_modules/.cache + - $HOME/.cache/yarn dist: trusty os: - linux script: - - yarn seed - yarn test + - yarn build + - yarn exp-publish +before_deploy: rm -rf .tmp node_modules build/client/ios build/client/android deploy: + skip_cleanup: true provider: heroku api_key: secure: fNhB+2DcXLoez7unhEMEUlL8WRBdWADn3Ye5Bm5MzFXVY2ZbjhhBaTo/v1XOHKRO/JrLNe7pzoaqwONWbhSTOe8sKBawUNQUAtcaR1MhZeLaCNGACblhc8YYffm4oRvwdv/N6GYZKo2aUsDwgkZmNu4GJFi3eBNXHaVobnzU09nnrs2WHm0JIiDs23z7TcIjTqC8sa7D7Q7LFeNhtsJl54s2s1wGfzEdhkPqc4OGM/87tLgtdwnCTPQs/nbetr6BfFndrT3fYmVbuFe6m4/e94eZHr7D/c2eiWEyb4FZv0FLkndY/7PCV0egUs1uSYkQeQcE2eAv5ZacgqYA9miFw3bhTEinM1ud0CfOxnYYtwniR4X0XxuHMpsVU71olChWnSwt7TvJG/uncjfvmWzWX+VA9f+n6Ya5+C893rledOLMrwJN6R+bqGLxBC0dwFI1Cfhxb/Io4/PjgmK0NNiSWJ+UCr26IEzKEAi7dz0zUqCDdykH9Co7R/hTeBT/rMrE0SYumc66Or4nhZohEFzdQSRBKtG+6xAcmMkLtut15grsxJ9+OvZUIIEoB2PFKuh4ephskEo5UQUQzVJscuFtDC+VIf+4vRwP8lvkV7LF6M8mN3FMyHwDb4+/q9lKIRAu4/fGY8P4NGrMSBgkgQI7CANgDj1mIROPsSVd4JVnpMc= diff --git a/README.md b/README.md index 178ed36d9b..2839a12211 100644 --- a/README.md +++ b/README.md @@ -441,12 +441,7 @@ yarn start ### Deploying to [Heroku] -1. Add your app to Heroku -1. Allow Heroku to install build time dependencies from the devDependencies in `package.json`: `Settings -> Config - Variables -> Add`, KEY: `YARN_PRODUCTION`, VALUE: `false`. -1. Add `EXP_USERNAME` and `EXP_PASSWORD` config variables there as well. They will be used to publish mobile Expo Client - applications -1. Deploy your app on Heroku +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) ### Heroku Demo diff --git a/package.json b/package.json index bba1ae2efb..10aefcbdb9 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "rollback": "knex migrate:rollback", "exp-login": "cross-env NODE_ENV=production spin exp login -u $EXP_USERNAME -p $EXP_PASSWORD --non-interactive", "watch": "spin watch", - "heroku-postbuild": "rm -rf build && npm run exp-login && npm run build && npm run exp -- p --non-interactive && npm run seed", + "exp-publish": "npm run exp-login && npm run exp -- p --non-interactive", + "heroku-postbuild": "NODE_ENV=production npm run seed", "precommit": "lint-staged", "cli": "node tools/cli", "postinstall": "opencollective postinstall", @@ -70,6 +71,9 @@ "apollo-logger": "0.1.1", "apollo-server-express": "^1.3.2", "apollo-upload-server": "^3.0.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-register": "^6.26.0", "bcryptjs": "^2.4.3", "body-parser": "^1.18.2", "bootstrap": "4.0.0-beta.2", @@ -150,14 +154,11 @@ "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-react-remove-prop-types": "^0.4.12", "babel-plugin-transform-runtime": "^6.23.0", - "babel-polyfill": "^6.26.0", - "babel-preset-env": "^1.6.1", "babel-preset-flow": "^6.23.0", "babel-preset-minify": "^0.2.0", "babel-preset-react": "^6.24.1", "babel-preset-react-native": "^4.0.0", "babel-preset-stage-0": "^6.24.1", - "babel-register": "^6.26.0", "caporal": "^0.9.0", "chai": "^4.1.2", "chai-http": "^3.0.0", diff --git a/tools/webpackAppConfig.js b/tools/webpackAppConfig.js index 6a257b95a7..cc93124572 100644 --- a/tools/webpackAppConfig.js +++ b/tools/webpackAppConfig.js @@ -42,6 +42,9 @@ const dependencyPlatforms = { antd: 'web', 'antd-mobile': ['ios', 'android'], 'apollo-engine': 'server', + 'babel-polyfill': 'server', + 'babel-preset-env': 'server', + 'babel-register': 'server', bcryptjs: 'server', 'body-parser': 'server', bootstrap: 'web',