react_on_rails 12.0.0.pre.beta.2 → 12.0.0.pre.beta.3
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 +4 -2
- data/README.md +23 -27
- data/SUMMARY.md +1 -1
- data/docs/basics/configuration.md +20 -15
- data/docs/basics/deployment.md +2 -3
- data/docs/basics/heroku-deployment.md +24 -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 +3 -4
- data/docs/basics/upgrading-react-on-rails.md +11 -9
- 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/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +2 -0
- data/lib/react_on_rails/configuration.rb +45 -6
- 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 +17 -10
- data/package.json +1 -1
- data/react_on_rails.gemspec +1 -0
- data/yarn.lock +260 -109
- metadata +17 -3
- 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.0.pre.beta.
|
4
|
+
version: 12.0.0.pre.beta.3
|
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-02 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,7 @@ 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
|
362
377
|
- docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md
|
363
378
|
- docs/basics/i18n.md
|
364
379
|
- docs/basics/installation-into-an-existing-rails-app.md
|
@@ -379,7 +394,6 @@ files:
|
|
379
394
|
- docs/misc/code_of_conduct.md
|
380
395
|
- docs/misc/doctrine.md
|
381
396
|
- docs/outdated/code-splitting.md
|
382
|
-
- docs/outdated/heroku-deployment.md
|
383
397
|
- docs/outdated/how-react-on-rails-works.md
|
384
398
|
- docs/outdated/manual-installation-overview.md
|
385
399
|
- docs/outdated/rails-assets-relative-paths.md
|
@@ -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
|
-
```
|