react_on_rails 11.2.1 → 11.2.2

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
  SHA256:
3
- metadata.gz: 58ddd567b8392bb832697cd980a5267f111d59bfa993bb50b47fc18599f249f5
4
- data.tar.gz: d16cc96276768d7739d4271247808dd65a1ce1566fdb44bc1e65283731756be1
3
+ metadata.gz: b201d34c57c3a7c915b6963a2755a8567ed73e3a41c85b26b77f2a7fcd945f39
4
+ data.tar.gz: b51be06e2a4dea5918a4685348ad6a42022a899f5be6ad39b2f865bd0bac9a10
5
5
  SHA512:
6
- metadata.gz: 188e2ec8f54d6019ad2e626cfd2f063485f9d30ab0c1d538e8b9dc43bbd7c9aa58e8c8fb9e4eee9a4d433ac1cbd4b81ad67ba828069b1959ad4176f8c26e0947
7
- data.tar.gz: ef4e23b168089ec5e05dd8dd1658fba60e73fbd8f90a38ffa503d1d47bc0831275a52d0e063d262e5e73f10a45c01aac7a4a19f3751bd946841290e89aef4e78
6
+ metadata.gz: 87902bf57cc4321b38c1c5492945a4a3d8238ce2721e8a5b378cc193e19877ac87ecf9b3ae4f5adf7420d9a861587fd65f5065832d3bfec4af974020309ebcd1
7
+ data.tar.gz: 21e392e0c4c7da53ecee2bae8023d052c2c015890ae0b38fedd7482cb7c8494c59a7c09bcac6a2ab1d0d0274a6fb23e676cd2ddc1a1bdf8d9d25e45c700e9e73
@@ -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.5.3
11
+ - 2.2.10
11
12
  services:
12
13
  - docker
13
14
 
@@ -54,13 +55,13 @@ 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
62
63
  - gemfile: spec/dummy/Gemfile
63
- rvm: 2.2.6
64
+ rvm: 2.2.10
64
65
 
65
66
  notifications:
66
67
  slack:
@@ -16,7 +16,14 @@ Changes since last non-beta release.
16
16
 
17
17
  *Please add entries here for your pull requests that are not yet released.*
18
18
 
19
- ### [11.2.0] - 2018-10-25
19
+ ### [11.2.2] - 2018-12-24
20
+ #### Improved
21
+ - rails_context can more easily be called from controller methods. The mandatory param of server_side has been made optional.
22
+
23
+ ### [11.2.1] - 2018-12-06
24
+ ## MIGRATION for v11.2
25
+ - If using **React on Rails Pro**, upgrade react_on_rails_pro to a version >= 1.3.
26
+
20
27
  #### Improved
21
28
  - 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).
22
29
 
@@ -30,7 +37,10 @@ Changes since last non-beta release.
30
37
 
31
38
  Thus, developers will need to fix server rendering errors before continuing.
32
39
  [PR 1145](https://github.com/shakacode/react_on_rails/pull/1145) by [justin808](https://github.com/justin808).
33
-
40
+
41
+ ### 11.2.0 - 2018-12-06
42
+ Do not use. Unpublished. Caused by an issue with the release script.
43
+
34
44
  ### [11.1.8] - 2018-10-14
35
45
 
36
46
  #### Improved
@@ -854,8 +864,9 @@ Best done with Object destructing:
854
864
  ##### Fixed
855
865
  - Fix several generator related issues.
856
866
 
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
867
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.2.2...master
868
+ [11.2.2]: https://github.com/shakacode/react_on_rails/compare/11.2.1...11.2.2
869
+ [11.2.1]: https://github.com/shakacode/react_on_rails/compare/11.1.8...11.2.1
859
870
  [11.1.8]: https://github.com/shakacode/react_on_rails/compare/11.1.7...11.1.8
860
871
  [11.1.7]: https://github.com/shakacode/react_on_rails/compare/11.1.6...11.1.7
861
872
  [11.1.6]: https://github.com/shakacode/react_on_rails/compare/11.1.5...11.1.6
@@ -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/README.md CHANGED
@@ -4,7 +4,7 @@
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? [Contact me](mailto:justin@shakacode.com).
8
8
 
9
9
  # Intro
10
10
 
@@ -36,7 +36,7 @@ React on Rails Pro provides Node server rendering and other performance enhancem
36
36
 
37
37
  [![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
38
 
39
- * [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](./docs/testimonials/hvmn.md)
39
+ * [HVMN Testimonial, by Paul Benigeri, October 12, 2018](./docs/testimonials/hvmn.md)
40
40
  * [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
41
  * [Egghead React on Rails Pro Deployment Highlights](https://github.com/shakacode/react_on_rails/wiki/Egghead-React-on-Rails-Pro-Deployment-Highlights)
42
42
 
@@ -63,6 +63,10 @@ Please [email me (Justin Gordon), the creator of React on Rails](mailto:justin@s
63
63
 
64
64
  > 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
65
 
66
+ [ResortPass Testimonial, by Leora Juster, December 10, 2018](./docs/testimonials/resortpass.md)
67
+
68
+ > 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.
69
+
66
70
  From Kyle Maune of Cooper Aerial, May 4, 2018
67
71
 
68
72
  ![image](https://user-images.githubusercontent.com/1118459/40891236-9b0b406e-671d-11e8-80ee-c026dbd1d5a2.png)
@@ -90,7 +94,7 @@ Note, the best way to understand how to use ReactOnRails is to study a few simpl
90
94
  1. Do the quick [tutorial](docs/tutorial.md).
91
95
  2. Add React on Rails to an existing Rails app per [the instructions](docs/basics/installation-into-an-existing-rails-app.md).
92
96
  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).
97
+ 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
98
 
95
99
  ## Basic Installation
96
100
 
@@ -266,7 +270,7 @@ ReactOnRails will automatically detect a registered generator function. Thus, th
266
270
 
267
271
  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
272
 
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:
273
+ 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
274
 
271
275
  ```js
272
276
  { renderedHtml: { componentHtml, customKey1, customKey2} }
@@ -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,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](./testimonials/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](./testimonials/hvmn.md).
7
+
8
+ ---
9
+
10
+ # [Leora from ResortPass](./testimonials/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:
@@ -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
 
@@ -60,7 +60,7 @@ bundle exec rails webpacker:install:react
60
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:
@@ -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(
@@ -488,58 +541,6 @@ module ReactOnRails
488
541
  result
489
542
  end
490
543
 
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
544
  def replay_console_option(val)
544
545
  val.nil? ? ReactOnRails.configuration.replay_console : val
545
546
  end
@@ -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.2.2".freeze
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "11.2.1",
3
+ "version": "11.2.2",
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.2.2
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: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -412,6 +412,7 @@ files:
412
412
  - docs/misc/doctrine.md
413
413
  - docs/misc/rails3.md
414
414
  - docs/testimonials/hvmn.md
415
+ - docs/testimonials/resortpass.md
415
416
  - docs/testimonials/testimonials.md
416
417
  - docs/tutorial.md
417
418
  - lib/generators/USAGE