react_on_rails 12.0.0.pre.beta.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -4
- data/README.md +27 -23
- data/SUMMARY.md +1 -1
- data/docs/basics/configuration.md +27 -16
- 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/rspec-configuration.md +27 -16
- data/docs/basics/upgrading-react-on-rails.md +14 -6
- data/docs/basics/webpack-configuration.md +3 -7
- data/docs/misc/doctrine.md +1 -1
- 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 +67 -61
- data/lib/generators/react_on_rails/base_generator.rb +2 -2
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +3 -1
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +26 -0
- data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -41
- 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/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 +36 -9
- data/lib/tasks/locale.rake +1 -5
- data/package.json +1 -1
- data/rakelib/release.rake +0 -6
- data/react_on_rails.gemspec +1 -0
- data/yarn.lock +260 -109
- metadata +21 -6
- data/docs/outdated/heroku-deployment.md +0 -86
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
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.0
|
4
|
+
version: 12.0.0
|
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-08 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
|
@@ -359,6 +373,8 @@ files:
|
|
359
373
|
- docs/basics/configuration.md
|
360
374
|
- docs/basics/deployment.md
|
361
375
|
- docs/basics/generator-details.md
|
376
|
+
- docs/basics/heroku-deployment.md
|
377
|
+
- docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md
|
362
378
|
- docs/basics/i18n.md
|
363
379
|
- docs/basics/installation-into-an-existing-rails-app.md
|
364
380
|
- docs/basics/migrating-from-react-rails.md
|
@@ -378,7 +394,6 @@ files:
|
|
378
394
|
- docs/misc/code_of_conduct.md
|
379
395
|
- docs/misc/doctrine.md
|
380
396
|
- docs/outdated/code-splitting.md
|
381
|
-
- docs/outdated/heroku-deployment.md
|
382
397
|
- docs/outdated/how-react-on-rails-works.md
|
383
398
|
- docs/outdated/manual-installation-overview.md
|
384
399
|
- docs/outdated/rails-assets-relative-paths.md
|
@@ -399,7 +414,7 @@ files:
|
|
399
414
|
- lib/generators/react_on_rails/react_with_redux_generator.rb
|
400
415
|
- lib/generators/react_on_rails/templates/.eslintrc
|
401
416
|
- lib/generators/react_on_rails/templates/base/base/Procfile.dev
|
402
|
-
- lib/generators/react_on_rails/templates/base/base/Procfile.dev-
|
417
|
+
- lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr
|
403
418
|
- lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
|
404
419
|
- lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx
|
405
420
|
- lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt
|
@@ -488,9 +503,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
488
503
|
version: 2.5.0
|
489
504
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
490
505
|
requirements:
|
491
|
-
- - "
|
506
|
+
- - ">="
|
492
507
|
- !ruby/object:Gem::Version
|
493
|
-
version:
|
508
|
+
version: '0'
|
494
509
|
requirements: []
|
495
510
|
rubygems_version: 3.0.8
|
496
511
|
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
|
-
```
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# You can run these commands in separate shells instead of using foreman
|
2
|
-
web: rails s -p 3000
|
3
|
-
|
4
|
-
# Next line runs the webpack-dev-server
|
5
|
-
# You can edit config/webpacker.yml to set HMR to true to see hot reloading.
|
6
|
-
# Note, hot and live reloading don't work with the default generator setup on top of
|
7
|
-
# the rails/webpacker Webpack config with server rendering.
|
8
|
-
# If you have server rendering enabled, modify the call to bin/webpack-dev-server line
|
9
|
-
# so you add `--inline=false` and then CSS is not inlined.
|
10
|
-
# Otherwise, you will have an error. If you want HMR and Server Rendering, see
|
11
|
-
# the example in the https://github.com/shakacode/react-webpack-rails-tutorial
|
12
|
-
client: sh -c 'rm -rf public/packs/* || true && bundle exec rake react_on_rails:locale && bin/webpack-dev-server'
|