react_on_rails 11.2.1 → 11.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ddd567b8392bb832697cd980a5267f111d59bfa993bb50b47fc18599f249f5
4
- data.tar.gz: d16cc96276768d7739d4271247808dd65a1ce1566fdb44bc1e65283731756be1
3
+ metadata.gz: 0bb16eb9dbe881e26404d0348b398cbf8fe74cc635b070830444b590b603b680
4
+ data.tar.gz: ff2fc0cde5a0a74959a6539ffec333f5350c913de8d14fe8650d3b9980a3d8c5
5
5
  SHA512:
6
- metadata.gz: 188e2ec8f54d6019ad2e626cfd2f063485f9d30ab0c1d538e8b9dc43bbd7c9aa58e8c8fb9e4eee9a4d433ac1cbd4b81ad67ba828069b1959ad4176f8c26e0947
7
- data.tar.gz: ef4e23b168089ec5e05dd8dd1658fba60e73fbd8f90a38ffa503d1d47bc0831275a52d0e063d262e5e73f10a45c01aac7a4a19f3751bd946841290e89aef4e78
6
+ metadata.gz: 0c868503c83f7af1b8cf3c2a6a297b045606cb26eaec5580d07ac1567e8d768071720cd5f7c497c576113cd78d0a70bfc677be125d54840b49480766c4662b47
7
+ data.tar.gz: 8dcaf2739c09a9689782a7a3e0f58036b86b88ce01092369e58296fc6235ffac4f18df3f8f19ead5db5d21c8ba53860da789d0b59994b220e96935d0fe39c904
data/.travis.yml CHANGED
@@ -4,10 +4,11 @@ language: ruby
4
4
 
5
5
  rvm:
6
6
  # Rails 5 requires 2.2
7
- - 2.3.1
8
- - 2.4.1
9
- - 2.5.0
10
- - 2.2.6
7
+ - 2.3.8
8
+ - 2.4.5
9
+ - 2.5.3
10
+ - 2.6.0
11
+ - 2.2.10
11
12
  services:
12
13
  - docker
13
14
 
@@ -36,7 +37,7 @@ before_install:
36
37
  - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen scn 1600x1200x16"
37
38
 
38
39
  install:
39
- - travis_retry gem install bundler
40
+ - travis_retry gem install bundler -v '<2' # Ruby 2.2 and Rails 3.2 & 4.2 depend on bundler 1.x.
40
41
  - travis_retry nvm install 8.11.3
41
42
  - node -v
42
43
  - travis_retry npm i -g yarn
@@ -54,13 +55,15 @@ script:
54
55
  matrix:
55
56
  exclude:
56
57
  - gemfile: spec/dummy_no_webpacker/Gemfile.rails32
57
- rvm: 2.3.1
58
+ rvm: 2.3.8
58
59
  - gemfile: spec/dummy_no_webpacker/Gemfile.rails32
59
- rvm: 2.4.1
60
+ rvm: 2.4.5
60
61
  - gemfile: spec/dummy_no_webpacker/Gemfile.rails32
61
- rvm: 2.5.0
62
+ rvm: 2.5.3
63
+ - gemfile: spec/dummy_no_webpacker/Gemfile.rails32
64
+ rvm: 2.6.0
62
65
  - gemfile: spec/dummy/Gemfile
63
- rvm: 2.2.6
66
+ rvm: 2.2.10
64
67
 
65
68
  notifications:
66
69
  slack:
data/CHANGELOG.md CHANGED
@@ -15,12 +15,26 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
15
15
  Changes since last non-beta release.
16
16
 
17
17
  *Please add entries here for your pull requests that are not yet released.*
18
+ ### [11.3.0] - 2019-04-20
19
+ #### Added
20
+ - Added method for retrieving any option from `render_options` [PR 1213](https://github.com/shakacode/react_on_rails/pull/1213)
21
+ by [ashgaliyev](https://github.com/ashgaliyev).
22
+
23
+ - html_options can now has option for 'tag' to add dynamically html element. like this: `html_options: { tag: "span" }`.
24
+ [PR 1208](https://github.com/shakacode/react_on_rails/pull/1208) by [tahsin352](https://github.com/tahsin352).
25
+
26
+ ### [11.2.2] - 2018-12-24
27
+ #### Improved
28
+ - rails_context can more easily be called from controller methods. The mandatory param of server_side has been made optional.
29
+
30
+ ### [11.2.1] - 2018-12-06
31
+ ## MIGRATION for v11.2
32
+ - If using **React on Rails Pro**, upgrade react_on_rails_pro to a version >= 1.3.
18
33
 
19
- ### [11.2.0] - 2018-10-25
20
34
  #### Improved
21
- - To support React v16, updated API for manually calling `ReactOnRails.render(name, props, domNodeId, hydrate)`. Added 3rd @param hydrate Pass truthy to update server rendered html. Default is falsey Any truthy values calls hydrate rather than render. (https://github.com/shakacode/react_on_rails/pull/1159) by [justin808](https://github.com/justin808) and [coopersamuel](https://github.com/coopersamuel).
35
+ - To support React v16, updated API for manually calling `ReactOnRails.render(name, props, domNodeId, hydrate)`. Added 3rd @param hydrate Pass truthy to update server rendered html. Default is falsey Any truthy values calls hydrate rather than render. [PR 1159](https://github.com/shakacode/react_on_rails/pull/1159) by [justin808](https://github.com/justin808) and [coopersamuel](https://github.com/coopersamuel).
22
36
 
23
- - Enabled the use of webpack-dev-server with Server-side rendering. (https://github.com/shakacode/react_on_rails/pull/1173) by [justin808](https://github.com/justin808) and [judahmeek](https://github.com/judahmeek).
37
+ - Enabled the use of webpack-dev-server with Server-side rendering. [PR 1173](https://github.com/shakacode/react_on_rails/pull/1173) by [justin808](https://github.com/justin808) and [judahmeek](https://github.com/judahmeek).
24
38
 
25
39
  #### Changed
26
40
  - Changed the default for:
@@ -30,7 +44,10 @@ Changes since last non-beta release.
30
44
 
31
45
  Thus, developers will need to fix server rendering errors before continuing.
32
46
  [PR 1145](https://github.com/shakacode/react_on_rails/pull/1145) by [justin808](https://github.com/justin808).
33
-
47
+
48
+ ### 11.2.0 - 2018-12-06
49
+ Do not use. Unpublished. Caused by an issue with the release script.
50
+
34
51
  ### [11.1.8] - 2018-10-14
35
52
 
36
53
  #### Improved
@@ -854,8 +871,10 @@ Best done with Object destructing:
854
871
  ##### Fixed
855
872
  - Fix several generator related issues.
856
873
 
857
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.2.0...master
858
- [11.2.0]: https://github.com/shakacode/react_on_rails/compare/11.1.8...11.2.0
874
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.3.0...master
875
+ [11.3.0]: https://github.com/shakacode/react_on_rails/compare/11.2.2...11.3.0
876
+ [11.2.2]: https://github.com/shakacode/react_on_rails/compare/11.2.1...11.2.2
877
+ [11.2.1]: https://github.com/shakacode/react_on_rails/compare/11.1.8...11.2.1
859
878
  [11.1.8]: https://github.com/shakacode/react_on_rails/compare/11.1.7...11.1.8
860
879
  [11.1.7]: https://github.com/shakacode/react_on_rails/compare/11.1.6...11.1.7
861
880
  [11.1.6]: https://github.com/shakacode/react_on_rails/compare/11.1.5...11.1.6
data/CONTRIBUTING.md CHANGED
@@ -107,7 +107,7 @@ cd spec/dummy
107
107
  yarn
108
108
  ```
109
109
 
110
- Note, yarn will run the `postinstall` script of `spec/dummy/client` which runs `yarn link` to setup a sym link to the parent package.
110
+ Note, yarn will run the `postinstall` script of `spec/dummy/client` which runs `yarn link` to set up a sym link to the parent package.
111
111
 
112
112
  #### Example: Testing NPM changes with the dummy app
113
113
  1. Add `console.log('Hello!')` [here](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/clientStartup.js#L181) in `react_on_rails/node_package/src/clientStartup.js` to confirm we're getting an update to the node package.
data/Gemfile CHANGED
@@ -30,11 +30,11 @@ gem "web-console", group: :development
30
30
  # below are copied from spec/dummy/Gemfile
31
31
  gem "capybara"
32
32
  gem "capybara-screenshot"
33
- gem "chromedriver-helper"
34
33
  gem "launchy"
35
34
  gem "rspec-rails"
36
35
  gem "rspec-retry"
37
36
  gem "selenium-webdriver"
37
+ gem "webdrivers", "~> 3.0"
38
38
  gem "webpacker"
39
39
 
40
40
  gem "equivalent-xml", github: "mbklein/equivalent-xml"
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # ReactOnRails
2
2
 
3
- [![License](https://img.shields.io/badge/license-mit-green.svg)](./LICENSE.md) [![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Codeship Status for shakacode/react_on_rails](https://app.codeship.com/projects/cec6c040-971f-0134-488f-0a5146246bd8/status?branch=master)](https://app.codeship.com/projects/187011) [![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master)
3
+ [![License](https://img.shields.io/badge/license-mit-green.svg)](./LICENSE.md) [![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master) [![](https://ruby-gem-downloads-badge.herokuapp.com/react_on_rails?type=total)](https://rubygems.org/gems/react_on_rails)
4
4
 
5
5
  React on Rails integrates Rails with (server rendering of) Facebook's [React](https://github.com/facebook/react) front-end framework.
6
6
 
7
- Intersted in optimizing your webpack setup for React on Rails including code splitting with react-router v4, webpack v4, and react-loadable? [Contact me](mailto:justin@shakacode.com).
7
+ Interested in optimizing your webpack setup for React on Rails including code splitting with react-router v4, webpack v4, and react-loadable with server side rendering? [Contact Justin Gordon](mailto:justin@shakacode.com).
8
8
 
9
9
  # Intro
10
10
 
@@ -17,12 +17,13 @@ To provide an opinionated and optimal framework for integrating Ruby on Rails wi
17
17
  Given that rails/webpacker gem already provides basic React integration, why would you use "React on Rails"?
18
18
 
19
19
  1. Server rendering, often used for SEO crawler indexing and UX performance, is not offered by rails/webpacker.
20
- 1. The 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 1request to your API.
21
- 1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/reactjs/react-router) integration.
20
+ 1. The 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.
21
+ 1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/reactjs/react-router) integration with server-side-rendering.
22
22
  1. [Internationalization (I18n) and (localization)](https://github.com/shakacode/react_on_rails/blob/master/docs/basics/i18n.md)
23
- 1. [RSpec Test Helpers Configuration](docs/basics/rspec-configuration.md) to ensure your Webpack bundles are ready for tests.
23
+ 1. [RSpec Test Helpers Configuration](docs/basics/rspec-configuration.md) to ensure your Webpack bundles are ready for tests. _(and for [Minitest](docs/basics/minitest-configuration.md))._
24
24
  1. A supportive community. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com/).
25
- 1. [Reason ML Support](https://github.com/shakacode/reason-react-on-rails-example)
25
+ 1. [Reason ML Support](https://github.com/shakacode/reason-react-on-rails-example).
26
+
26
27
 
27
28
  See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
28
29
 
@@ -36,7 +37,7 @@ React on Rails Pro provides Node server rendering and other performance enhancem
36
37
 
37
38
  [![2018-09-11_10-31-11](https://user-images.githubusercontent.com/1118459/45467845-5bcc7400-b6bd-11e8-91e1-e0cf806d4ea4.png)](https://blog.shakacode.com/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro-eb08226687db)
38
39
 
39
- * [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](./docs/testimonials/hvmn.md)
40
+ * [HVMN Testimonial, by Paul Benigeri, October 12, 2018](./docs/testimonials/hvmn.md)
40
41
  * [HVMN’s 90% Reduction in Server Response Time from React on Rails Pro](https://blog.shakacode.com/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro-eb08226687db)
41
42
  * [Egghead React on Rails Pro Deployment Highlights](https://github.com/shakacode/react_on_rails/wiki/Egghead-React-on-Rails-Pro-Deployment-Highlights)
42
43
 
@@ -63,6 +64,10 @@ Please [email me (Justin Gordon), the creator of React on Rails](mailto:justin@s
63
64
 
64
65
  > The price we paid for the consultation + the React on Rails pro license has already been made back a couple of times from hosting fees alone. The entire process was super hands off, and our core team was able to focus on shipping new feature during that sprint.
65
66
 
67
+ [ResortPass Testimonial, by Leora Juster, December 10, 2018](./docs/testimonials/resortpass.md)
68
+
69
+ > Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds.
70
+
66
71
  From Kyle Maune of Cooper Aerial, May 4, 2018
67
72
 
68
73
  ![image](https://user-images.githubusercontent.com/1118459/40891236-9b0b406e-671d-11e8-80ee-c026dbd1d5a2.png)
@@ -90,7 +95,7 @@ Note, the best way to understand how to use ReactOnRails is to study a few simpl
90
95
  1. Do the quick [tutorial](docs/tutorial.md).
91
96
  2. Add React on Rails to an existing Rails app per [the instructions](docs/basics/installation-into-an-existing-rails-app.md).
92
97
  3. Look at [spec/dummy](spec/dummy), a simple, no DB example.
93
- 3. Look at [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial); it's a full featured example live at [www.reactrails.com](http://www.reactrails.com).
98
+ 3. Look at [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial); it's a full-featured example live at [www.reactrails.com](http://www.reactrails.com).
94
99
 
95
100
  ## Basic Installation
96
101
 
@@ -266,7 +271,7 @@ ReactOnRails will automatically detect a registered generator function. Thus, th
266
271
 
267
272
  Another reason to use a generator function is that sometimes in server rendering, specifically with React Router, you need to return the result of calling ReactDOMServer.renderToString(element). You can do this by returning an object with the following shape: { renderedHtml, redirectLocation, error }. Make sure you use this function with `react_component_hash`.
268
273
 
269
- For server rendering, if you wish to return multiple HTML strings from a generator function, you may return an Object from your generator function with a single top level property of `renderedHtml`. Inside this Object, place a key called `componentHtml`, along with any other needed keys. An example scenario of this is when you are using side effects libraries like [React Helmet](https://github.com/nfl/react-helmet). Your Ruby code will get this Object as a Hash containing keys componentHtml and any other custom keys that you added:
274
+ For server rendering, if you wish to return multiple HTML strings from a generator function, you may return an Object from your generator function with a single top-level property of `renderedHtml`. Inside this Object, place a key called `componentHtml`, along with any other needed keys. An example scenario of this is when you are using side effects libraries like [React Helmet](https://github.com/nfl/react-helmet). Your Ruby code will get this Object as a Hash containing keys componentHtml and any other custom keys that you added:
270
275
 
271
276
  ```js
272
277
  { renderedHtml: { componentHtml, customKey1, customKey2} }
@@ -321,10 +326,14 @@ Bug reports and pull requests are welcome. See [Contributing](CONTRIBUTING.md) t
321
326
 
322
327
  # Supporters
323
328
 
324
- The following companies support this open source project, and ShakaCode uses their products! Justin writes React on Rails on [RubyMine](https://www.jetbrains.com/ruby/). We use [Scout](https://scoutapp.com/) to monitor the live performance of [HawaiiChee.com](https://www.hawaiichee.com), and we use [BrowserStack](https://www.browserstack.com) to solve problems with oddball browsers.
329
+ The following companies support this open source project, and ShakaCode uses their products! Justin writes React on Rails on [RubyMine](https://www.jetbrains.com/ruby/). We use [Scout](https://scoutapp.com/) to monitor the live performance of [HawaiiChee.com](https://www.hawaiichee.com), [BrowserStack](https://www.browserstack.com) to solve problems with oddball browsers, and [CodersRank](https://codersrank.io/) to find candidates for our team.
325
330
 
326
331
  [![Scout](https://user-images.githubusercontent.com/1118459/41828269-106b40f8-77d0-11e8-8d19-9c4b167ef9d8.png)](https://scoutapp.com/)
327
332
  [![BrowserStack](https://cloud.githubusercontent.com/assets/1118459/23203304/1261e468-f886-11e6-819e-93b1a3f17da4.png)](https://www.browserstack.com)
333
+ [![CodersRank](https://user-images.githubusercontent.com/1118459/55040254-ad8a7b00-4fcb-11e9-8936-c6765eb30698.png)](https://codersrank.io/?utm_source=github&utm_medium=banner&utm_campaign=shakacode)
334
+
335
+ ## Clubhouse
336
+ I've just moved ShakaCode's development to [ClubHouse](https://clubhouse.io/) from Trello. We're going to be doing this with all our projects. If you want to **try ClubHouse and get 2 months free beyond the 14-day trial period**, click [here to use ShakaCode's referral code](http://r.clbh.se/mvfd30S). We're participating in their awesome triple-sided referral program, which you can read about [here](https://clubhouse.io/blog/clubhouse-referral-program-5f614bb437c3). By using our [referral code](http://r.clbh.se/mvfd30S) you'll be supporting ShakaCode and, thus, React on Rails!
328
337
 
329
338
  *If you'd like to support React on Rails and have your company listed here, [get in touch](mailto:justin@shakacode.com).*
330
339
 
data/SUMMARY.md CHANGED
@@ -14,6 +14,7 @@
14
14
  + [Deployment](docs/basics/deployment.md).
15
15
  + [React on Rails Internationalization (I18n, localization)](docs/basics/i18n.md)
16
16
  + [RSpec Test Helpers Configuration](docs/basics/rspec-configuration.md)
17
+ + [Minitest Configuration](docs/basics/minitest-configuration.md)
17
18
  + [Upgrading React on Rails](docs/basics/upgrading-react-on-rails.md)
18
19
 
19
20
  ## **API**
@@ -40,7 +41,7 @@
40
41
  + [Babel](./docs/additional-reading/babel.md)
41
42
  + [React Router](./docs/additional-reading/react-router.md)
42
43
  + [React & Redux](./docs/additional-reading/react-and-redux.md)
43
- + [Webpack Tips](./docs/additional-reading/webpack-tips.md)
44
+ + [Webpack Tips](./docs/additional-reading/webpack.md)
44
45
  + [Server Rendering Tips](./docs/additional-reading/server-rendering-tips.md)
45
46
  + [Code Splitting](docs/misc-pending/code-splitting.md)
46
47
  + [AngularJS Integration and Migration to React on Rails](./docs/additional-reading/angular-js-integration-migration.md)
@@ -28,7 +28,7 @@ Uncommonly used options:
28
28
  - **props:** Ruby Hash which contains the properties to pass to the react object, or a JSON string. If you pass a string, we'll escape it for you.
29
29
  - **prerender:** enable server-side rendering of a component. Set to false when debugging!
30
30
  - **id:** Id for the div, will be used to attach the React component. This will get assigned automatically if you do not provide an id. Must be unique.
31
- - **html_options:** Any other HTML options get placed on the added div for the component. For example, you can set a class (or inline style) on the outer div so that it behaves like a span, with the styling of `display:inline-block`.
31
+ - **html_options:** Any other HTML options get placed on the added div for the component. For example, you can set a class (or inline style) on the outer div so that it behaves like a span, with the styling of `display:inline-block`. You may also use an option of `tag: "span"` to replace the use of the default DIV tag to be a SPAN tag.
32
32
  - **trace:** set to true to print additional debugging information in the browser. Defaults to true for development, off otherwise. Only on the **client side** will you will see the `railsContext` and your props.
33
33
  - **random_dom_id:** True to automatically generate random dom ids when using multiple instances of the same React component on one Rails view.
34
34
  - **options if prerender (server rendering) is true:**
@@ -93,7 +93,7 @@ end %>
93
93
 
94
94
  ### rails_context
95
95
 
96
- You can call `rails_context(server_side: true | false)` from your controller or view to see what values are are in the Rails Context. Pass true or false depending on whether you want to see the server side or the client side rails_context.
96
+ You can call `rails_context` or `rails_context(server_side: true|false)` from your controller or view to see what values are are in the Rails Context. Pass true or false depending on whether you want to see the server side or the client side rails_context. Typically, for computing cache keys, you should leave server_side as the default true. When calling this from a controller method, use `helpers.rails_context`.
97
97
 
98
98
  ------------
99
99
 
@@ -0,0 +1,31 @@
1
+ # Minitest Configuration
2
+
3
+ The setup for minitest is the same as for rspec with the following difference.
4
+
5
+ Rather than calling `ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)`, instead you will do something like this:
6
+
7
+ ```ruby
8
+ class ActiveSupport::TestCase
9
+ setup do
10
+ ReactOnRails::TestHelper.ensure_assets_compiled
11
+ end
12
+ end
13
+ ```
14
+
15
+
16
+ Or maybe something like this, from the [minitest docs](https://github.com/seattlerb/minitest/blob/master/lib/minitest/test.rb#L119):
17
+
18
+ ```ruby
19
+ module MyMinitestPlugin
20
+ def before_setup
21
+ super
22
+ ReactOnRails::TestHelper.ensure_assets_compiled
23
+ end
24
+ end
25
+
26
+ class MiniTest::Test
27
+ include MyMinitestPlugin
28
+ end
29
+ ```
30
+
31
+
@@ -1,4 +1,6 @@
1
1
  # RSpec Configuration
2
+ _Click [here for minitest](./minitest-configuration.md)_
3
+
2
4
  Because you will probably want to run RSpec tests that rely on compiled webpack assets (typically, your integration/feature specs where `js: true`), you will want to ensure you don't accidentally run tests on missing or stale webpack assets. If you did use stale Webpack assets, you will get invalid test results as your tests do not use the very latest JavaScript code.
3
5
 
4
6
  ReactOnRails provides a helper method called `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`. Call this method from inside of the `RSpec.configure` block in your `spec/rails_helper.rb` file, passing the config as an argument. See file [lib/react_on_rails/test_helper.rb](../../lib/react_on_rails/test_helper.rb) for more details. You can customize this to your particular needs by replacing any of the default components used by `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`.
@@ -55,8 +57,6 @@ If you want to speed up the re-compiling process so you don't wait to run your t
55
57
 
56
58
  [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) contains examples of how to set the proc files for this purpose.
57
59
 
58
- If you want to use a testing framework other than RSpec, please submit let us know on the changes you need to do and we'll update the docs.
59
-
60
60
  ![2016-01-27_02-36-43](https://cloud.githubusercontent.com/assets/1118459/12611951/7c56d070-c4a4-11e5-8a80-9615f99960d9.png)
61
61
 
62
62
  ![2016-01-27_03-18-05](https://cloud.githubusercontent.com/assets/1118459/12611975/a8011654-c4a4-11e5-84f9-1baca4835b4b.png)
@@ -5,12 +5,22 @@ If you would like help in migrating between React on Rails versions or help with
5
5
 
6
6
  We specialize in helping companies to quickly and efficiently move from versions before 9 to current. The older versions use the Rails asset pipeline to package client assets. The current and recommended way is to use Webpack 4 for asset preparation. You may also need help migrating from the `rails/webpacker`'s Webpack configuration to a better setup ready for Server Side Rendering.
7
7
 
8
+ ## Upgrading rails/webpacker from v3 to v4
9
+ ### Custom Webpack build file
10
+ The default value for `extract_css` is **false** in `config/webpack.yml`. Custom webpack builds should set this value to true or else no CSS link tags are generated. You have a custom webpack build if you are not using [rails/webpacker](https://github.com/rails/webpacker to setup your Webpack configuration.
11
+
12
+ ```yml
13
+ default: &default
14
+ # other stuff
15
+ extract_css: true
16
+ # by default, extract and emit a css file. The default is false
17
+ ```
18
+
8
19
  ## Upgrading to version 11
9
20
  * Remove `server_render_method` from config/initializers/react_on_rails.rb. Alternate server rendering methods are part of React on Rails Pro. If you want to use a custom renderer, contact justin@shakacode.com. We have a custom node rendering solution in production for egghead.io.
10
21
  * Remove your usage of ENV["TRACE_REACT_ON_RAILS"] usage. You can get all tracing with either specifying **`trace`** at your component or in your config/initializers/react_on_rails.rb file.
11
22
  * ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name were removed. React on Rails Pro contains upgrades to enable component and other types caching with React on Rails.
12
23
 
13
-
14
24
  ## Upgrading to version 10
15
25
 
16
26
  Pretty simple:
@@ -0,0 +1,13 @@
1
+ # ResortPass Testimonial, by Leora Juster, December 10, 2018
2
+
3
+ Many can write code that "works." Even fewer can write sophisticated code that both works and reflects a deep understanding of the technologies and paradigms involved. Only a select few can do the aforementioned while assisting in managing the expectations and time constraints of less technically informed members of software product teams to make the best design decisions possible. Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds. The code and CSS files are well-organized and contain repeatable patterns easy to understand, allowing my team to build on what has already been accomplished. I learned a great deal from my interactions with Justin and his team, as they are just as great teachers as they are developers, and feel like I get to continually learn from them as I build on top of their code. Their different support and pro plan options make it easy to build a continuous professional relationship despite fluctuations in my team's funding, and their team is always extremely personable, punctual, and professional.
4
+
5
+ Leora Juster, Full-Stack Lead Software Developer
6
+
7
+ [LinkedIn](https://www.linkedin.com/in/leora-juster-38933050)
8
+
9
+ ![image](https://user-images.githubusercontent.com/1118459/50050877-30399b00-00ab-11e9-9e52-2977de45ccae.png)
10
+
11
+ [ResortPass](https://resortpass.com/)
12
+
13
+ [![2018-12-15_20-48-35](https://user-images.githubusercontent.com/1118459/50050866-03858380-00ab-11e9-8588-461112f8045b.png)](https://resortpass.com/)
@@ -1,8 +1,18 @@
1
1
  # Testimonials
2
- [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](./testimonials/hvmn.md)
2
+ # [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](./hvmn.md)
3
3
 
4
4
  > The price we paid for the consultation + the React on Rails pro license has already been made back a couple of times from hosting fees alone. The entire process was super hands off, and our core team was able to focus on shipping new feature during that sprint.
5
5
 
6
+ Full writeup [here](./hvmn.md).
7
+
8
+ ---
9
+
10
+ # [Leora from ResortPass](./resortpass.md), December 10, 2018
11
+
12
+ Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds.
13
+
14
+ Full writeup [here](./testimonials/resortpass.md).
15
+
6
16
  ---
7
17
 
8
18
  From Joel Hooks, Co-Founder, Chief Nerd at [egghead.io](https://egghead.io/), January 30, 2017:
data/docs/tutorial.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # React on Rails Basic Tutorial
2
2
 
3
- This tutorial guides you through setting up a new or existing Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering. It is updated to 11.1.4.
3
+ This tutorial guides you through setting up a new or existing Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering. It is updated to 11.2.1.
4
4
 
5
5
  After finishing this tutorial you will get an application that can do the following (live on Heroku):
6
6
 
@@ -57,10 +57,10 @@ bundle exec rails webpacker:install
57
57
  bundle exec rails webpacker:install:react
58
58
  ```
59
59
 
60
- Add the **React On Rails** gem to your Gemfile:
60
+ Add the **React On Rails** gem to your `Gemfile`:
61
61
 
62
62
  ```
63
- gem 'react_on_rails', '11.1.7' # prefer exact gem version to match npm version
63
+ gem 'react_on_rails', '11.2.1' # prefer exact gem version to match npm version
64
64
  ```
65
65
 
66
66
  Note: Latest released React On Rails version is considered stable. Please use the latest version to ensure you get all the security patches and the best support.
@@ -101,11 +101,11 @@ Note, foreman defaults to PORT 5000 unless you set the value of PORT in your env
101
101
  ## Using a pre-release of rails/webpacker
102
102
  Until `rails/webpacker` v4 ships, or if you ever want to try out the master branch, you can modify the React on Rails tutorial instructions slightly. You can see the sequence of commits here. To summarize:
103
103
 
104
- Don't `run rails new with the --webpack=react option`. Instead, add the webpacker gem to the Gemfile such that it points to master, like this if `11.2.0` is the version you want.
104
+ **Don't run `rails new` with the `--webpack=react` option**. Instead, add the webpacker gem to the Gemfile such that it points to master, like this if `11.2.1` is the version you want.
105
105
 
106
106
  ```ruby
107
107
  gem 'webpacker', github: "rails/webpacker"
108
- gem 'react_on_rails', '11.2.0' # always use exact version
108
+ gem 'react_on_rails', '11.2.1' # always use exact version
109
109
  ```
110
110
 
111
111
  Then run these commands:
@@ -243,7 +243,7 @@ end
243
243
  Then after all changes are done don't forget to commit them with git and finally you can push your app to Heroku!
244
244
 
245
245
  ```
246
- git add -a
246
+ git add -A
247
247
  git commit -m "Changes for Heroku"
248
248
  git push heroku master
249
249
  ```
@@ -268,7 +268,7 @@ You can turn on server rendering by simply changing the `prerender` option to `t
268
268
  Then push to Heroku:
269
269
 
270
270
  ```
271
- git add -a
271
+ git add -A
272
272
  git commit -m "Enable server rendering"
273
273
  git push heroku master
274
274
  ```
@@ -277,6 +277,59 @@ module ReactOnRails
277
277
  ReactOnRails::JsonOutput.escape(json_value)
278
278
  end
279
279
 
280
+ # This is the definitive list of the default values used for the rails_context, which is the
281
+ # second parameter passed to both component and store generator functions.
282
+ # This method can be called from views and from the controller, as `helpers.rails_context`
283
+ #
284
+ # rubocop:disable Metrics/AbcSize
285
+ def rails_context(server_side: true)
286
+ @rails_context ||= begin
287
+ result = {
288
+ railsEnv: Rails.env,
289
+ inMailer: in_mailer?,
290
+ # Locale settings
291
+ i18nLocale: I18n.locale,
292
+ i18nDefaultLocale: I18n.default_locale,
293
+ rorVersion: ReactOnRails::VERSION,
294
+ rorPro: ReactOnRails::Utils.react_on_rails_pro?
295
+ }
296
+ if defined?(request) && request.present?
297
+ # Check for encoding of the request's original_url and try to force-encoding the
298
+ # URLs as UTF-8. This situation can occur in browsers that do not encode the
299
+ # entire URL as UTF-8 already, mostly on the Windows platform (IE11 and lower).
300
+ original_url_normalized = request.original_url
301
+ if original_url_normalized.encoding.to_s == "ASCII-8BIT"
302
+ original_url_normalized = original_url_normalized.force_encoding("ISO-8859-1").encode("UTF-8")
303
+ end
304
+
305
+ # Using Addressable instead of standard URI to better deal with
306
+ # non-ASCII characters (see https://github.com/shakacode/react_on_rails/pull/405)
307
+ uri = Addressable::URI.parse(original_url_normalized)
308
+ # uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
309
+
310
+ result.merge!(
311
+ # URL settings
312
+ href: uri.to_s,
313
+ location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}",
314
+ scheme: uri.scheme, # http
315
+ host: uri.host, # foo.com
316
+ port: uri.port,
317
+ pathname: uri.path, # /posts
318
+ search: uri.query, # id=30&limit=5
319
+ httpAcceptLanguage: request.env["HTTP_ACCEPT_LANGUAGE"]
320
+ )
321
+ end
322
+ if ReactOnRails.configuration.rendering_extension
323
+ custom_context = ReactOnRails.configuration.rendering_extension.custom_context(self)
324
+ result.merge!(custom_context) if custom_context
325
+ end
326
+ result
327
+ end
328
+
329
+ @rails_context.merge(serverSide: server_side)
330
+ end
331
+ # rubocop:enable Metrics/AbcSize
332
+
280
333
  private
281
334
 
282
335
  def build_react_component_result_for_server_rendered_string(
@@ -286,9 +339,15 @@ module ReactOnRails
286
339
  render_options: required("render_options")
287
340
  )
288
341
  content_tag_options = render_options.html_options
342
+ if content_tag_options.key?(:tag)
343
+ content_tag_options_html_tag = content_tag_options[:tag]
344
+ content_tag_options.delete(:tag)
345
+ else
346
+ content_tag_options_html_tag = "div"
347
+ end
289
348
  content_tag_options[:id] = render_options.dom_id
290
349
 
291
- rendered_output = content_tag(:div,
350
+ rendered_output = content_tag(content_tag_options_html_tag.to_sym,
292
351
  server_rendered_html.html_safe,
293
352
  content_tag_options)
294
353
 
@@ -488,58 +547,6 @@ module ReactOnRails
488
547
  result
489
548
  end
490
549
 
491
- # This is the definitive list of the default values used for the rails_context, which is the
492
- # second parameter passed to both component and store generator functions.
493
- # rubocop:disable Metrics/AbcSize
494
- def rails_context(server_side: required("server_side"))
495
- @rails_context ||= begin
496
- result = {
497
- railsEnv: Rails.env,
498
- inMailer: in_mailer?,
499
- # Locale settings
500
- i18nLocale: I18n.locale,
501
- i18nDefaultLocale: I18n.default_locale,
502
- rorVersion: ReactOnRails::VERSION,
503
- rorPro: ReactOnRails::Utils.react_on_rails_pro?
504
- }
505
- if defined?(request) && request.present?
506
- # Check for encoding of the request's original_url and try to force-encoding the
507
- # URLs as UTF-8. This situation can occur in browsers that do not encode the
508
- # entire URL as UTF-8 already, mostly on the Windows platform (IE11 and lower).
509
- original_url_normalized = request.original_url
510
- if original_url_normalized.encoding.to_s == "ASCII-8BIT"
511
- original_url_normalized = original_url_normalized.force_encoding("ISO-8859-1").encode("UTF-8")
512
- end
513
-
514
- # Using Addressable instead of standard URI to better deal with
515
- # non-ASCII characters (see https://github.com/shakacode/react_on_rails/pull/405)
516
- uri = Addressable::URI.parse(original_url_normalized)
517
- # uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
518
-
519
- result.merge!(
520
- # URL settings
521
- href: uri.to_s,
522
- location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}",
523
- scheme: uri.scheme, # http
524
- host: uri.host, # foo.com
525
- port: uri.port,
526
- pathname: uri.path, # /posts
527
- search: uri.query, # id=30&limit=5
528
- httpAcceptLanguage: request.env["HTTP_ACCEPT_LANGUAGE"]
529
- )
530
- end
531
- if ReactOnRails.configuration.rendering_extension
532
- custom_context = ReactOnRails.configuration.rendering_extension.custom_context(self)
533
- result.merge!(custom_context) if custom_context
534
- end
535
- result
536
- end
537
-
538
- @rails_context.merge(serverSide: server_side)
539
- end
540
-
541
- # rubocop:enable Metrics/AbcSize
542
-
543
550
  def replay_console_option(val)
544
551
  val.nil? ? ReactOnRails.configuration.replay_console : val
545
552
  end
@@ -72,6 +72,10 @@ module ReactOnRails
72
72
  "{ react_component_name = #{react_component_name}, options = #{options}, request_digest = #{request_digest}"
73
73
  end
74
74
 
75
+ def internal_option(key)
76
+ options[key]
77
+ end
78
+
75
79
  private
76
80
 
77
81
  attr_reader :options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "11.2.1".freeze
4
+ VERSION = "11.3.0".freeze
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "11.2.1",
3
+ "version": "11.3.0",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
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: 11.2.1
4
+ version: 11.3.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: 2018-12-06 00:00:00.000000000 Z
11
+ date: 2019-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -396,6 +396,7 @@ files:
396
396
  - docs/basics/i18n.md
397
397
  - docs/basics/installation-into-an-existing-rails-app.md
398
398
  - docs/basics/migrating-from-react-rails.md
399
+ - docs/basics/minitest-configuration.md
399
400
  - docs/basics/react-server-rendering.md
400
401
  - docs/basics/recommended-project-structure.md
401
402
  - docs/basics/rspec-configuration.md
@@ -412,6 +413,7 @@ files:
412
413
  - docs/misc/doctrine.md
413
414
  - docs/misc/rails3.md
414
415
  - docs/testimonials/hvmn.md
416
+ - docs/testimonials/resortpass.md
415
417
  - docs/testimonials/testimonials.md
416
418
  - docs/tutorial.md
417
419
  - lib/generators/USAGE
@@ -516,7 +518,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
518
  version: '0'
517
519
  requirements: []
518
520
  rubyforge_project:
519
- rubygems_version: 2.7.6
521
+ rubygems_version: 2.7.9
520
522
  signing_key:
521
523
  specification_version: 4
522
524
  summary: Rails with react server rendering with webpack.