Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache client/node_modules during heroku deploys #324

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
## [Unreleased]
##### Added
- Non-digested version of assets in public folder [#413](https://github.com/shakacode/react_on_rails/pull/413) by [alleycat-at-git]

- Cache client/node_modules directory to prevent Heroku from reinstalling all modules from scratch [#324](https://github.com/shakacode/react_on_rails/pull/324) by [modosc]
##### Changed
- Replace URI with Addressable gem. See [#405](https://github.com/shakacode/react_on_rails/pull/405) by [lucke84]

Expand All @@ -25,7 +25,7 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
- [Security] Address failure to sanitize console messages when server rendering and displaying in the browser console. See [#366](https://github.com/shakacode/react_on_rails/pull/366) and [#370](https://github.com/shakacode/react_on_rails/pull/370) by [justin808](https://github.com/justin808)

##### Added
- railsContext includes the port number and a boolean if the code is being run on the server or client.
- railsContext includes the port number and a boolean if the code is being run on the server or client.

## [5.1.0] - 2016-04-03
##### Added
Expand Down
12 changes: 9 additions & 3 deletions docs/additional-reading/heroku-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ The generator has created the necessary files and gems for deployment to Heroku.
+ `config/puma.rb`: Puma webserver config file
+ `lib/tasks/assets.rake`: This rake task file is provided by the generator regardless of whether the user chose Heroku Deployment as an option. It is highlighted here because it is helpful to understand that this task is what generates your JavaScript bundles in production.

By default Heroku will cache the root `node_modules` directory between deploys but since we're installing in `client/node_modules` you'll need to add the following line to the `package.json` in your root directory (otherwise you'll have to sit through a full `npm install` on each deploy):
```
"cacheDirectories": [
"node_modules",
"client/node_modules"
],

```

## How to Deploy

React on Rails requires both a ruby environment (for Rails) and a Node environment (for Webpack), so you will need to have Heroku use multiple buildpacks.
Expand Down Expand Up @@ -94,6 +103,3 @@ namespace :assets do
end
end
```



Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<%- end -%>
"test": "echo \"Error: no test specified\" && exit 1"
},
"cacheDirectories": ["node_modules", "client/node_modules"],
"dependencies": {
"autoprefixer": "^6.3.5",
"axios": "^0.9.1",
Expand Down