react_on_rails 9.0.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 726ec46ad50d1fe90c1362e3b500edc55c9c7061
4
- data.tar.gz: '0882d017eeafe5a267fced472d736e248ef53294'
3
+ metadata.gz: 22b05c194abe4ce3e30fe5b6bb4d99aac182b97b
4
+ data.tar.gz: 2d1506bdd2916fccae557e80c832dc5ffd7431b4
5
5
  SHA512:
6
- metadata.gz: 869d84250e0b3e582100bb91bcd0e038746fad8d1badbeec51a05ac202a48c5f36bfca545db2453820bb591d7aeb9a23fcb38c30d3864d30403c2e526971184e
7
- data.tar.gz: 6f2e9bf6b123f2f6cd86fee23f8482d303e56565f23b0c86fd5de1033a6942a25bc78bca4ef677f036ec7e540e3706926f0071496bcaac66e142f287b1ec78de
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
- - Fix regression where `react_component(... prerender: true)` wouldn't find the generated asset bundle, because it wasn't looking for the hashed path.
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
- ## 9.0 from 8.x. Upgrade Instructions
15
- All 9.0.0 beta versions can be viewed in [PR 908](https://github.com/shakacode/react_on_rails/pull/908)
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
- #### fixed
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
- #### fixed
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/rails-webpacker...9.0.0-beta.11
772
- [9.0.0]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.11
773
- [9.0.0-beta.12]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.11...9.0.0-beta.12
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 updated [Tutorial](https://github.com/shakacode/react_on_rails/blob/rails-webpacker/docs/tutorial.md).
10
- * See the [CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/rails-webpacker/CHANGELOG.md) for migration instructions.
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 beta gem version: `gem 'react_on_rails', '~> 9.0.0.beta.12'`
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
- * **[VERSION 9.0.0.beta (branch)](https://github.com/shakacode/react_on_rails/tree/rails-webpacker) shipped!** This version depends on Webpacker directly. See the [CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/rails-webpacker/CHANGELOG.md) for migration instructions.
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 8.1.0 including support for [webpacker_lite](https://github.com/shakacode/webpacker_lite). The docs on [on the 9.0.0 beta branch](https://github.com/shakacode/react_on_rails/tree/rails-webpacker) refer to using Webpacker rather than Webpacker Lite.
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
- cd client && yarn add react-on-rails
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 4.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.
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
@@ -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 = begin
76
- bundle_js_file_path(bundle_name)
77
- rescue Webpacker::Manifest::MissingEntryError
78
- Rails.root.join(File.join(Webpacker.config.public_output_path, bundle_name)).to_s
79
- end
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "9.0.0"
4
+ VERSION = "9.0.1"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -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,**/utils_spec.rb,"\
25
- "**/webpack_assets_status_checker_spec.rb,**/test_helper/*_spec.rb\""
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.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-07 00:00:00.000000000 Z
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow