react_on_rails 9.0.0 → 9.0.1
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 +13 -69
- data/README.md +40 -12
- data/docs/tutorial.md +5 -3
- data/lib/react_on_rails/server_rendering_pool/exec.rb +1 -1
- data/lib/react_on_rails/utils.rb +10 -5
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- data/rakelib/run_rspec.rake +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22b05c194abe4ce3e30fe5b6bb4d99aac182b97b
|
|
4
|
+
data.tar.gz: 2d1506bdd2916fccae557e80c832dc5ffd7431b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 489037474e139d7438204792df316967d3c454a72c8df0062f403fbbfb64b8cee9558570395b9b615144f3d9081e90b1ee1fb27eac4af69bdda16c3afd28d0be
|
|
7
|
+
data.tar.gz: 213cd4baddb2044a154dbb1021b2be647e433d6273f2a91b25936f59a99d6b48317d0b4d957391e6143c9e453e7628475fd36691630e4f807c3aadd840d1838b
|
data/CHANGELOG.md
CHANGED
|
@@ -8,11 +8,16 @@ Changes since last non-beta release.
|
|
|
8
8
|
|
|
9
9
|
*Please add entries here for your pull requests.*
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### [9.0.1]
|
|
12
12
|
|
|
13
|
+
#### Fixed
|
|
14
|
+
- Fixes Rails 3.2 compatability issues. [PR 926](https://github.com/shakacode/react_on_rails/pull/926) by [morozovm](https://github.com/morozovm )
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
### [9.0.0]
|
|
17
|
+
Updated React on Rails to depend on [rails/webpacker](https://github.com/rails/webpacker). [PR 908](https://github.com/shakacode/react_on_rails/pull/908) by [justin808](https://github.com/justin808).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#### 9.0 from 8.x. Upgrade Instructions
|
|
16
21
|
|
|
17
22
|
For an example of upgrading, see [react-webpack-rails-tutorial/pull/416](https://github.com/shakacode/react-webpack-rails-tutorial/pull/416).
|
|
18
23
|
|
|
@@ -96,62 +101,12 @@ gem "webpacker"
|
|
|
96
101
|
- Set the `hmr` key in your `webpacker.yml` to `true`.
|
|
97
102
|
|
|
98
103
|
|
|
99
|
-
#### Troubleshooting
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### [9.0.0]
|
|
104
|
-
*Diffs for the beta to master*
|
|
105
|
-
|
|
106
|
-
### [9.0.0-beta.12]
|
|
107
|
-
- Updated for latest rails/webpacker using the official gem
|
|
108
|
-
- hot reloading working in generator
|
|
109
|
-
|
|
110
|
-
### [9.0.0-beta.11]
|
|
111
|
-
- Updated for latest rails_webpacker.
|
|
112
|
-
- hot reloading working in spec/dummy
|
|
113
|
-
|
|
114
|
-
### [9.0.0-beta.10]
|
|
115
|
-
- Updated for the latest rails/webpacker. Added the cache_manifest setting.
|
|
116
|
-
|
|
117
|
-
### [9.0.0-beta.9]
|
|
118
|
-
- Fixes precompile task going to Webpacker's. You need to set `custom_compile: true` in your `webpacker.yml`.
|
|
119
|
-
- Changed webpack-bundle.js name to hello-world-bundle.js
|
|
120
|
-
- Update for latest from rails/webpacker
|
|
121
|
-
gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
|
122
|
-
branch: "issue-464-merge-webpacker-lite-into-webpacker-v3"
|
|
123
|
-
|
|
124
|
-
### [9.0.0-beta.8]
|
|
125
|
-
- bugfix for server rendering
|
|
126
|
-
|
|
127
|
-
### [9.0.0-beta.7]
|
|
128
|
-
- Depend on updated rails/webpacker in branch
|
|
129
|
-
|
|
130
|
-
gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
|
131
|
-
branch: "issue-464-merge-webpacker-lite-into-webpacker-v2"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
### [9.0.0-beta.6]
|
|
135
|
-
- Change "hot" to "hmr".
|
|
136
|
-
|
|
137
|
-
### [9.0.0-beta.3]
|
|
138
|
-
- Fix typo on webpackConfigLoader.js
|
|
139
|
-
|
|
140
|
-
### [9.0.0-beta.3]
|
|
141
|
-
- Fix typo on webpackConfigLoader.js
|
|
142
|
-
|
|
143
|
-
### [9.0.0-beta.2]
|
|
144
|
-
- Fixed problems when running in development mode for both the generator and spec/dummy.
|
|
145
|
-
|
|
146
|
-
### [9.0.0-beta.1]
|
|
147
|
-
- First version of depending on Webpacker rather than Webpacker Lite
|
|
148
|
-
|
|
149
104
|
### [8.0.7]
|
|
150
|
-
####
|
|
105
|
+
#### Fixed
|
|
151
106
|
- Fixes generator bug by keeping blank line at top in case existing .gitignore does not end in a newline. [#916](https://github.com/shakacode/react_on_rails/pull/916) by [justin808](https://github.com/justin808).
|
|
152
107
|
|
|
153
108
|
### [8.0.6]
|
|
154
|
-
####
|
|
109
|
+
#### Fixed
|
|
155
110
|
- Fixes server rendering when using a CDN. Server rendering would try to fetch a file with the "asset_host". This change updates the webpacker_lite dependency to 2.1.0 which has a new helper `pack_path`. [#901](https://github.com/shakacode/react_on_rails/pull/901) by [justin808](https://github.com/justin808). Be sure to update webpacker_lite to 2.1.0.
|
|
156
111
|
- The package.json file created by the generator now creates minified javascript production builds by default. This was done by adding the -p flag to webpack on the build:production script. [#895](https://github.com/shakacode/react_on_rails/pull/895) by [serodriguez68 ](https://github.com/serodriguez68)
|
|
157
112
|
- Fixes GitUtils.uncommitted_changes? throwing an error when called in an environment without Git, and allows install generator to be run successfully with `--ignore-warnings` [#878](https://github.com/shakacode/react_on_rails/pull/878) by [jasonblalock](https://github.com/jasonblalock).
|
|
@@ -768,20 +723,9 @@ Best done with Object destructing:
|
|
|
768
723
|
##### Fixed
|
|
769
724
|
- Fix several generator related issues.
|
|
770
725
|
|
|
771
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/
|
|
772
|
-
[9.0.
|
|
773
|
-
[9.0.0
|
|
774
|
-
[9.0.0-beta.11]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.10...9.0.0-beta.11
|
|
775
|
-
[9.0.0-beta.10]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.9...9.0.0-beta.10
|
|
776
|
-
[9.0.0-beta.9]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.8...9.0.0-beta.9
|
|
777
|
-
[9.0.0-beta.8]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.7...9.0.0-beta.8
|
|
778
|
-
[9.0.0-beta.7]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.6...9.0.0-beta.7
|
|
779
|
-
[9.0.0-beta.6]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.5...9.0.0-beta.6
|
|
780
|
-
[9.0.0-beta.5]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.4...9.0.0-beta.5
|
|
781
|
-
[9.0.0-beta.4]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.3...9.0.0-beta.4
|
|
782
|
-
[9.0.0-beta.3]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.2...9.0.0-beta.3
|
|
783
|
-
[9.0.0-beta.2]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.1...9.0.0-beta.2
|
|
784
|
-
[9.0.0-beta.1]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.1
|
|
726
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/9.0.1...master
|
|
727
|
+
[9.0.1]: https://github.com/shakacode/react_on_rails/compare/9.0.0...9.0.1
|
|
728
|
+
[9.0.0]: https://github.com/shakacode/react_on_rails/compare/8.0.7...9.0.0
|
|
785
729
|
[8.0.7]: https://github.com/shakacode/react_on_rails/compare/8.0.6...8.0.7
|
|
786
730
|
[8.0.6]: https://github.com/shakacode/react_on_rails/compare/8.0.5...8.0.6
|
|
787
731
|
[8.0.5]: https://github.com/shakacode/react_on_rails/compare/8.0.3...8.0.5
|
data/README.md
CHANGED
|
@@ -3,25 +3,55 @@
|
|
|
3
3
|
*If this projects helps you, please give us a star!*
|
|
4
4
|
|
|
5
5
|
[rails/webpacker](https://github.com/rails/webpacker) just shipped 3.0. This now enables me to ship version 9.0. See [PR #908](https://github.com/shakacode/react_on_rails/pull/908) for more details.
|
|
6
|
-
|
|
7
6
|
# React on Rails v9 is based on Webpacker 3.0!
|
|
8
7
|
|
|
9
|
-
* See the
|
|
10
|
-
* See the [
|
|
8
|
+
* See the article React on Rails plus Webpacker, Peanut Butter and Jelly for an overview of the integration of React on Rails with Webpacker (article coming soon).
|
|
9
|
+
* See the updated [Tutorial](https://github.com/shakacode/react_on_rails/blob/master/docs/tutorial.md).
|
|
10
|
+
* See the [CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) for migration instructions.
|
|
11
|
+
|
|
12
|
+
----
|
|
13
|
+
|
|
14
|
+
Given that Webpacker already provides React integration, why would you add React on Rails? Additional features of React on Rails include:
|
|
15
|
+
|
|
16
|
+
1. Server rendering, often for SEO optimization.
|
|
17
|
+
2. Easy passing of props directly from your Rails view to your React components rather than having your Rails view load and then make a separate request to your API.
|
|
18
|
+
3. Redux and React-Router integration
|
|
19
|
+
4. Localization support
|
|
20
|
+
5. Rspec test helpers to ensure your Webpack bundles are ready for tests
|
|
21
|
+
|
|
22
|
+
----
|
|
23
|
+
|
|
24
|
+
## Steps to a New App with rails/webpacker v3 plus React on Rails v9:
|
|
25
|
+
First be sure to run `rails -v` and check that you are using Rails 5.1.3 or above. If you are using an older version of Rails, you'll need to install webpacker with React per the instructions [here](https://github.com/rails/webpacker).
|
|
26
|
+
|
|
27
|
+
### Basic installation
|
|
11
28
|
|
|
12
|
-
## Steps to a New App with rails/webpacker v3 plus React on Rails v9.beta:
|
|
13
29
|
1. New Rails app: `rails new my-app --webpack=react`. `cd` into the directory.
|
|
14
|
-
2. Add
|
|
30
|
+
2. Add gem version: `gem 'react_on_rails', '~> 9.0.1'`
|
|
15
31
|
3. Run the generator: `rails generate react_on_rails:install`
|
|
16
32
|
4. Start the app: `foreman start -f Procfile.dev`
|
|
17
33
|
5. Visit http://localhost:3000/hello_world
|
|
18
34
|
|
|
19
|
-
Turn on HMR (Hot reloading)
|
|
35
|
+
### Turn on HMR (Hot reloading)
|
|
36
|
+
|
|
20
37
|
1. Edit `config/webpacker.yml` and set `hmr: true`
|
|
21
38
|
2. Start the app: `foreman start -f Procfile.dev-server`
|
|
22
39
|
3. Visit http://localhost:3000/hello_world
|
|
23
40
|
4. Edit `app/javascript/bundles/HelloWorld/components/HelloWorld.jsx`, hit save, and see the screen update.
|
|
24
41
|
|
|
42
|
+
### Turn on server rendering
|
|
43
|
+
|
|
44
|
+
*Does not work with hot reloading, yet, per [Webpacker issue #732](https://github.com/rails/webpacker/issues/732)*
|
|
45
|
+
|
|
46
|
+
1. Edit `app/views/hello_world/index.html.erb` and set `prerender` to `true`.
|
|
47
|
+
2. Refresh the page.
|
|
48
|
+
|
|
49
|
+
This is the line where you turn server rendering on by setting prerender to true:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
<%%= react_component("HelloWorld", props: @hello_world_props, prerender: false) %>
|
|
53
|
+
```
|
|
54
|
+
|
|
25
55
|
---------------
|
|
26
56
|
|
|
27
57
|
## Thank you from Justin Gordon and [ShakaCode](http://www.shakacode.com)
|
|
@@ -95,9 +125,9 @@ For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](./KUDOS.md).
|
|
|
95
125
|
------
|
|
96
126
|
|
|
97
127
|
# NEWS
|
|
98
|
-
* **
|
|
128
|
+
* 2017-09-06: **VERSION 9.0.0 shipped!** This version depends on Webpacker directly. See the [CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md) for migration instructions.
|
|
99
129
|
* [VERSION 8.1.0](https://rubygems.org/gems/react_on_rails/) shipped with [webpacker_lite](https://github.com/shakacode/webpacker_lite) (soon [**webpacker**](https://github.com/rails/webpacker/issues/464#issuecomment-310986140) support! [react-webpack-rails-tutorial PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395) shows the changes needed to migrate from the Asset Pipeline to Webpacker Lite. For more information, see my article: [Webpacker Lite: Why Fork Webpacker?](https://blog.shakacode.com/webpacker-lite-why-fork-webpacker-f0a7707fac92). Per recent discussions, we [will merge Webpacker Lite changes back into Webpacker](https://github.com/rails/webpacker/issues/464#issuecomment-310986140). There's no reason to wait for this. The upgrade will eventually be trivial.
|
|
100
|
-
* The Docs here on `master` refer to
|
|
130
|
+
* The Docs here on `master` refer to 9.x including support for [rails/webpacker](https://github.com/rails/webpacker).
|
|
101
131
|
*Use the [7.0.4 docs](https://github.com/shakacode/react_on_rails/tree/7.0.4) to refer to the older asset pipeline way.*
|
|
102
132
|
* *See [NEWS.md](NEWS.md) for more notes over time.*
|
|
103
133
|
|
|
@@ -252,10 +282,10 @@ React on Rails provides an option for automatic conversions of Rails `*.yml` loc
|
|
|
252
282
|
See the [How to add I18n](docs/basics/i18n.md) for a summary of adding I18n.
|
|
253
283
|
|
|
254
284
|
## NPM
|
|
255
|
-
All JavaScript in React On Rails is loaded from npm: [react-on-rails](https://www.npmjs.com/package/react-on-rails). To manually install this (you did not use the generator), assuming you have a standard configuration, run this command:
|
|
285
|
+
All JavaScript in React On Rails is loaded from npm: [react-on-rails](https://www.npmjs.com/package/react-on-rails). To manually install this (you did not use the generator), assuming you have a standard configuration, run this command (assuming you are in the directory where you have your `node_modules`):
|
|
256
286
|
|
|
257
287
|
```bash
|
|
258
|
-
|
|
288
|
+
yarn add react-on-rails
|
|
259
289
|
```
|
|
260
290
|
|
|
261
291
|
That will install the latest version and update your package.json.
|
|
@@ -606,8 +636,6 @@ If you want to use a node server for server rendering, [get in touch](mailto:jus
|
|
|
606
636
|
|
|
607
637
|
## Additional Documentation
|
|
608
638
|
**Try out our new [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference!**
|
|
609
|
-
+ **Webpacker Lite**
|
|
610
|
-
+ [Webpacker Lite: Why Fork Webpacker?](https://blog.shakacode.com/webpacker-lite-why-fork-webpacker-f0a7707fac92)
|
|
611
639
|
|
|
612
640
|
+ **Rails**
|
|
613
641
|
+ [Rails Assets](./docs/additional-reading/rails-assets.md)
|
data/docs/tutorial.md
CHANGED
|
@@ -22,7 +22,7 @@ _Note: some of the screen images below show the "npm" command. react_on_rails 6.
|
|
|
22
22
|
|
|
23
23
|
## Setting up the environment
|
|
24
24
|
|
|
25
|
-
Trying out **React on Rails** is super easy, so long as you have the basic prerequisites. This includes the basics for Rails
|
|
25
|
+
Trying out **React on Rails** is super easy, so long as you have the basic prerequisites. This includes the basics for Rails 5.x and node version 6+. I recommend `rvm` and `nvm` to install Ruby and Node, and [brew](https://brew.sh/) to install [yarn](https://yarnpkg.com/en/docs/install#mac-tab). Rails can be installed as an ordinary gem.
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
nvm install node # download and install latest stable Node
|
|
@@ -39,7 +39,9 @@ gem install rails # download and install latest stable Rails
|
|
|
39
39
|
gem install foreman # download and install Foreman
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
Then we need to create a fresh Rails application with webpacker react support as following
|
|
42
|
+
Then we need to create a fresh Rails application with webpacker react support as following. Be sure that
|
|
43
|
+
|
|
44
|
+
First be sure to run `rails -v` and check you are using Rails 5.1.3 or above. If you are using an older version of Rails, you'll need to install webpacker with react per the instructions [here](https://github.com/rails/webpacker).
|
|
43
45
|
|
|
44
46
|
```
|
|
45
47
|
cd <directory where you want to create your new Rails app>
|
|
@@ -50,7 +52,7 @@ rails new test-react-on-rails --webpack=react
|
|
|
50
52
|
cd test-react-on-rails
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
Note: you can do the following two commands in an existing Rails app:
|
|
55
|
+
Note: you can do the following two commands in an existing Rails app or pre Rails 5.1.3:
|
|
54
56
|
|
|
55
57
|
```
|
|
56
58
|
bundle exec rails webpacker:install
|
|
@@ -19,7 +19,7 @@ module ReactOnRails
|
|
|
19
19
|
|
|
20
20
|
server_bundle_js_file_path = ReactOnRails::Utils.server_bundle_js_file_path
|
|
21
21
|
|
|
22
|
-
if Webpacker.dev_server.running?
|
|
22
|
+
if Utils.using_webpacker? && Webpacker.dev_server.running?
|
|
23
23
|
return if @last_loaded_server_bundle == server_bundle_js_file_path
|
|
24
24
|
@last_loaded_server_bundle = server_bundle_js_file_path
|
|
25
25
|
else
|
data/lib/react_on_rails/utils.rb
CHANGED
|
@@ -72,11 +72,16 @@ exitstatus: #{status.exitstatus}#{stdout_msg}#{stderr_msg}
|
|
|
72
72
|
return @server_bundle_path if @server_bundle_path && !Rails.env.development?
|
|
73
73
|
|
|
74
74
|
bundle_name = ReactOnRails.configuration.server_bundle_js_file
|
|
75
|
-
@server_bundle_path =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
@server_bundle_path = if using_webpacker?
|
|
76
|
+
begin
|
|
77
|
+
bundle_js_file_path(bundle_name)
|
|
78
|
+
rescue Webpacker::Manifest::MissingEntryError
|
|
79
|
+
Rails.root.join(File.join(Webpacker.config.public_output_path,
|
|
80
|
+
bundle_name)).to_s
|
|
81
|
+
end
|
|
82
|
+
else
|
|
83
|
+
bundle_js_file_path(bundle_name)
|
|
84
|
+
end
|
|
80
85
|
end
|
|
81
86
|
|
|
82
87
|
def self.bundle_js_file_path(bundle_name)
|
data/package.json
CHANGED
data/rakelib/run_rspec.rake
CHANGED
|
@@ -20,9 +20,9 @@ namespace :run_rspec do
|
|
|
20
20
|
|
|
21
21
|
desc "Run RSpec with rails32 gemfile"
|
|
22
22
|
task :gem_rails32 do
|
|
23
|
-
rspec_args = "spec/react_on_rails --exclude-pattern "\
|
|
24
|
-
"\"**/generators/*_spec.rb
|
|
25
|
-
"**/
|
|
23
|
+
rspec_args = "spec/react_on_rails --tag ~webpacker --exclude-pattern "\
|
|
24
|
+
"\"**/generators/*_spec.rb,"\
|
|
25
|
+
"**/test_helper/webpack_*_spec.rb\""
|
|
26
26
|
run_tests_in("",
|
|
27
27
|
rspec_args: rspec_args,
|
|
28
28
|
env_vars: "BUNDLE_GEMFILE=spec/dummy_no_webpacker/Gemfile.rails32")
|
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: 9.0.
|
|
4
|
+
version: 9.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: 2017-09-
|
|
11
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rainbow
|