react_on_rails 12.0.0.pre.beta.1 → 12.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +6 -4
- data/CHANGELOG.md +27 -17
- data/README.md +77 -79
- data/SUMMARY.md +1 -1
- data/docs/additional-reading/converting-from-custom-webpack-config-to-rails-webpacker-config.md +10 -0
- data/docs/additional-reading/react-router.md +1 -1
- data/docs/additional-reading/server-rendering-tips.md +4 -1
- data/docs/api/javascript-api.md +3 -3
- data/docs/api/redux-store-api.md +2 -2
- data/docs/api/view-helpers-api.md +4 -4
- data/docs/basics/configuration.md +28 -17
- data/docs/basics/deployment.md +2 -3
- data/docs/basics/heroku-deployment.md +24 -0
- data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +49 -0
- data/docs/basics/i18n.md +3 -3
- data/docs/basics/installation-into-an-existing-rails-app.md +2 -7
- data/docs/basics/recommended-project-structure.md +5 -22
- data/docs/basics/render-functions-and-railscontext.md +1 -1
- data/docs/basics/rspec-configuration.md +27 -16
- data/docs/basics/upgrading-react-on-rails.md +35 -13
- data/docs/basics/webpack-configuration.md +3 -7
- data/docs/misc/doctrine.md +1 -1
- data/docs/outdated/code-splitting.md +3 -3
- data/docs/outdated/how-react-on-rails-works.md +8 -4
- data/docs/outdated/manual-installation-overview.md +1 -1
- data/docs/outdated/rails-assets.md +0 -7
- data/docs/tutorial.md +40 -30
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +17 -9
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +4 -1
- data/lib/react_on_rails/configuration.rb +45 -6
- data/lib/react_on_rails/helper.rb +8 -8
- data/lib/react_on_rails/locales/base.rb +8 -0
- data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +1 -1
- data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +17 -0
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/webpacker_utils.rb +6 -0
- data/lib/tasks/assets.rake +47 -8
- data/lib/tasks/locale.rake +1 -5
- data/package.json +1 -1
- data/rakelib/examples.rake +1 -1
- data/rakelib/lint.rake +1 -1
- data/rakelib/release.rake +1 -3
- data/react_on_rails.gemspec +1 -0
- data/yarn.lock +260 -109
- metadata +21 -5
- data/docs/outdated/heroku-deployment.md +0 -86
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.
|
4
|
+
version: 12.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webpacker
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: awesome_print
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -332,6 +346,7 @@ files:
|
|
332
346
|
- docs/additional-reading/asset-pipeline.md
|
333
347
|
- docs/additional-reading/capistrano-deployment.md
|
334
348
|
- docs/additional-reading/convert-rails-5-api-only-app.md
|
349
|
+
- docs/additional-reading/converting-from-custom-webpack-config-to-rails-webpacker-config.md
|
335
350
|
- docs/additional-reading/credits.md
|
336
351
|
- docs/additional-reading/elastic-beanstalk.md
|
337
352
|
- docs/additional-reading/foreman-issues.md
|
@@ -359,6 +374,8 @@ files:
|
|
359
374
|
- docs/basics/configuration.md
|
360
375
|
- docs/basics/deployment.md
|
361
376
|
- docs/basics/generator-details.md
|
377
|
+
- docs/basics/heroku-deployment.md
|
378
|
+
- docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md
|
362
379
|
- docs/basics/i18n.md
|
363
380
|
- docs/basics/installation-into-an-existing-rails-app.md
|
364
381
|
- docs/basics/migrating-from-react-rails.md
|
@@ -378,7 +395,6 @@ files:
|
|
378
395
|
- docs/misc/code_of_conduct.md
|
379
396
|
- docs/misc/doctrine.md
|
380
397
|
- docs/outdated/code-splitting.md
|
381
|
-
- docs/outdated/heroku-deployment.md
|
382
398
|
- docs/outdated/how-react-on-rails-works.md
|
383
399
|
- docs/outdated/manual-installation-overview.md
|
384
400
|
- docs/outdated/rails-assets-relative-paths.md
|
@@ -488,9 +504,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
488
504
|
version: 2.5.0
|
489
505
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
490
506
|
requirements:
|
491
|
-
- - "
|
507
|
+
- - ">="
|
492
508
|
- !ruby/object:Gem::Version
|
493
|
-
version:
|
509
|
+
version: '0'
|
494
510
|
requirements: []
|
495
511
|
rubygems_version: 3.0.8
|
496
512
|
signing_key:
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# Heroku Deployment
|
2
|
-
The generator has created the necessary files and gems for deployment to Heroku. If you have installed manually, you will need to provide these files yourself:
|
3
|
-
|
4
|
-
+ `Procfile`: used by Heroku and Foreman to start the Puma server
|
5
|
-
+ `'puma'` gem: recommended Heroku webserver
|
6
|
-
+ `config/puma.rb`: Puma webserver config file
|
7
|
-
|
8
|
-
If you want to see an updated example deployed to Heroku, please visit the [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial).
|
9
|
-
|
10
|
-
## More details on precompilation using webpack to create JavaScript assets
|
11
|
-
This is how the `assets:precompile` rake task gets modified by `react_on_rails`. You should be able to call `clear_prerequisites` and setup your own custom precompile if needed.
|
12
|
-
```ruby
|
13
|
-
# These tasks run as pre-requisites of assets:precompile.
|
14
|
-
# Note, it's not possible to refer to ReactOnRails configuration values at this point.
|
15
|
-
Rake::Task["assets:precompile"]
|
16
|
-
.clear_prerequisites
|
17
|
-
.enhance([:environment, "react_on_rails:assets:compile_environment"])
|
18
|
-
```
|
19
|
-
|
20
|
-
For an example of how to do this, see the [dummy app](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/lib/tasks/assets.rake).
|
21
|
-
|
22
|
-
## Caching Node Modules
|
23
|
-
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 `yarn` on each deploy):
|
24
|
-
|
25
|
-
```js
|
26
|
-
"cacheDirectories": [
|
27
|
-
"node_modules",
|
28
|
-
"client/node_modules"
|
29
|
-
],
|
30
|
-
```
|
31
|
-
|
32
|
-
## How to Deploy
|
33
|
-
|
34
|
-
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.
|
35
|
-
|
36
|
-
Assuming you have downloaded and installed the Heroku command-line utility and have initialized the app, you will need to tell Heroku to use both buildpacks via the command-line:
|
37
|
-
|
38
|
-
```
|
39
|
-
heroku buildpacks:set heroku/ruby
|
40
|
-
heroku buildpacks:add --index 1 heroku/nodejs
|
41
|
-
```
|
42
|
-
|
43
|
-
For more information, see [Using Multiple Buildpacks for an App](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app)
|
44
|
-
|
45
|
-
## Fresh Rails Install
|
46
|
-
|
47
|
-
### Swap out sqlite for postgres by doing the following:
|
48
|
-
|
49
|
-
#### 1. Delete the line with `sqlite` and replace it with:
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
gem 'pg'
|
53
|
-
```
|
54
|
-
|
55
|
-
#### 2. Replace your `database.yml` file with this (assuming your app name is "ror")
|
56
|
-
|
57
|
-
```yml
|
58
|
-
default: &default
|
59
|
-
adapter: postgresql
|
60
|
-
username:
|
61
|
-
password:
|
62
|
-
host: localhost
|
63
|
-
|
64
|
-
development:
|
65
|
-
<<: *default
|
66
|
-
database: ror_development
|
67
|
-
|
68
|
-
# Warning: The database defined as "test" will be erased and
|
69
|
-
# re-generated from your development database when you run "rake".
|
70
|
-
# Do not set this db to the same as development or production.
|
71
|
-
test:
|
72
|
-
<<: *default
|
73
|
-
database: ror_test
|
74
|
-
|
75
|
-
production:
|
76
|
-
<<: *default
|
77
|
-
database: ror_production
|
78
|
-
```
|
79
|
-
|
80
|
-
Run:
|
81
|
-
|
82
|
-
```
|
83
|
-
bundle
|
84
|
-
bin/rake db:setup
|
85
|
-
bin/rake db:migrate
|
86
|
-
```
|