react_on_rails 11.0.0 → 11.1.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.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +1 -1
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +80 -3
  5. data/CONTRIBUTING.md +7 -8
  6. data/{docs/LICENSE.md → LICENSE.md} +1 -1
  7. data/PROJECTS.md +7 -1
  8. data/README.md +175 -637
  9. data/Rakefile +4 -1
  10. data/SUMMARY.md +39 -26
  11. data/docs/additional-reading/convert-rails-5-api-only-app.md +19 -0
  12. data/docs/additional-reading/credits.md +10 -0
  13. data/docs/additional-reading/rails-assets-relative-paths.md +2 -2
  14. data/docs/additional-reading/rails-engine-integration.md +7 -0
  15. data/docs/additional-reading/server-rendering-tips.md +2 -4
  16. data/docs/additional-reading/webpack.md +2 -2
  17. data/docs/api/javascript-api.md +21 -1
  18. data/docs/api/redux-store-api.md +100 -0
  19. data/docs/api/view-helpers-api.md +130 -0
  20. data/docs/articles.md +20 -0
  21. data/docs/basics/client-vs-server-rendering.md +17 -0
  22. data/docs/basics/configuration.md +39 -5
  23. data/docs/basics/deployment.md +6 -0
  24. data/docs/basics/{generator.md → generator-details.md} +4 -7
  25. data/docs/basics/generator-functions-and-railscontext.md +157 -0
  26. data/docs/basics/how-react-on-rails-works.md +40 -0
  27. data/docs/basics/installation-into-an-existing-rails-app.md +64 -0
  28. data/docs/basics/react-server-rendering.md +27 -0
  29. data/docs/{additional-reading → basics}/recommended-project-structure.md +26 -4
  30. data/docs/{additional-reading → basics}/rspec-configuration.md +12 -6
  31. data/docs/basics/upgrading-react-on-rails.md +3 -3
  32. data/docs/basics/webpack-configuration.md +29 -0
  33. data/docs/misc/doctrine.md +1 -1
  34. data/docs/{additional-reading → misc-pending}/code-splitting.md +8 -2
  35. data/docs/{basics/installation-overview.md → misc-pending/manual-installation-overview.md} +3 -8
  36. data/docs/{additional-reading → misc-pending}/rails-assets.md +3 -1
  37. data/docs/testimonials.md +11 -0
  38. data/docs/tutorial.md +4 -4
  39. data/lib/generators/USAGE +1 -1
  40. data/lib/react_on_rails/configuration.rb +139 -97
  41. data/lib/react_on_rails/{react_on_rails_helper.rb → helper.rb} +104 -79
  42. data/lib/react_on_rails/json_parse_error.rb +26 -0
  43. data/lib/react_on_rails/prerender_error.rb +48 -6
  44. data/lib/react_on_rails/react_component/render_options.rb +94 -0
  45. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +58 -50
  46. data/lib/react_on_rails/server_rendering_pool.rb +4 -16
  47. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +10 -6
  48. data/lib/react_on_rails/test_helper.rb +8 -7
  49. data/lib/react_on_rails/utils.rb +38 -6
  50. data/lib/react_on_rails/version.rb +1 -1
  51. data/lib/react_on_rails/version_syntax_converter.rb +14 -12
  52. data/lib/react_on_rails/webpacker_utils.rb +11 -8
  53. data/lib/react_on_rails.rb +4 -2
  54. data/package.json +3 -2
  55. data/rakelib/release.rake +1 -1
  56. data/react_on_rails.gemspec +2 -2
  57. metadata +32 -21
  58. data/docs/additional-reading/caching-and-performance.md +0 -4
  59. data/docs/additional-reading/node-server-rendering.md +0 -5
  60. data/docs/api/ruby-api.md +0 -8
  61. data/lib/react_on_rails/react_component/options.rb +0 -64
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 31c09a3e5f99dd68c101be042157d0df07ce3d28
4
- data.tar.gz: c1b5a351538f6f66b02fd6b7d9dbc9016f9b7a5a
2
+ SHA256:
3
+ metadata.gz: c8d7e72c5130da6716546e083faf1253a40f39b3e794de46c9872845fb452974
4
+ data.tar.gz: 3dd67dfec4427ea009f42f662f038c01d752f509a212485849b2967ee24189cc
5
5
  SHA512:
6
- metadata.gz: ed448da2f9649ab1fe01df7e3f9f5391a0ab0a0d00d19588d4d4ec7463d0967ba4680c820175e20dc4c9a083561aa7783c9d0925c0a9013c8e0af49755c23309
7
- data.tar.gz: c4db1f97a32d563a83e11fd0987160cabe408caa88fef4880d96be89da8ca752a5218a426370cf1834bdbdc36ea537c3d97bd5b98eb70110fd299d2ac9a72072
6
+ metadata.gz: 39dc9b2f86a178e84108f39b51109d84701700f5b69dbaa15141c849fb8a993d4eacb0ff09f8c272c73c9b18d9446b69daf2c668bc478d7d0c0ddbb15128c273
7
+ data.tar.gz: cd6de63a8fa962763954193d86e7f8b1a813f13a0abdd5257b5a1356dce89f6d588205c3bb4359d3a0237d6e39fd8d8bdde534b45d8eb30b19e6e8b5a8ebf95c
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.1
6
+ TargetRubyVersion: 2.2
7
7
 
8
8
  Include:
9
9
  - '**/Rakefile'
data/.travis.yml CHANGED
@@ -37,9 +37,9 @@ before_install:
37
37
 
38
38
  install:
39
39
  - travis_retry gem install bundler
40
- - travis_retry nvm install node 8.0.0
40
+ - travis_retry nvm install 8.11.3
41
41
  - node -v
42
- - travis_retry npm i -g yarn@0.27.5
42
+ - travis_retry npm i -g yarn
43
43
  - travis_retry yarn global add babel-cli
44
44
  - travis_retry bundle install
45
45
  - travis_retry yarn
data/CHANGELOG.md CHANGED
@@ -9,20 +9,85 @@ See [Upgrading React on Rails](./docs/basics/upgrading-react-on-rails.md) for mo
9
9
  Changes since last non-beta release.
10
10
 
11
11
  *Please add entries here for your pull requests that are not yet released.*
12
+ ### [11.1.0] - 2018-08-07
13
+ #### Added
14
+ - Add random dom id option. This new global and react_component helper option allows configuring whether or not React on Rails will automatically add a random id to the DOM node ID. (https://github.com/shakacode/react_on_rails/pull/1121) by [justin808](https://github.com/justin808)
15
+ * Added configuration option random_dom_id
16
+ * Added method RenderOptions has_random_dom_id?
17
+ #### Fixed
18
+ - Fix invalid warn directive. (https://github.com/shakacode/react_on_rails/pull/1123) by [mustangostang](https://github.com/mustangostang).
19
+
20
+ ### [11.0.10] - 2018-07-22
21
+ #### Fixed
22
+ - Much better logging of rendering errors when there are lots of props. Only the a 1,000 chars are logged, and the center is indicated to be truncated. [PR 1117](https://github.com/shakacode/react_on_rails/pull/1117) and [PR 1118](https://github.com/shakacode/react_on_rails/pull/1118) by [justin808](https://github.com/justin808).
23
+ - Properly clearing hydrated stores when server rendering. [PR 1120](https://github.com/shakacode/react_on_rails/pull/1120) by [squadette](https://github.com/squadette).
24
+
25
+ ### [11.0.9] - 2018-06-24
26
+ - Handle <script async> for Webpack bundle transparently. Closes [issue #290](https://github.com/shakacode/react_on_rails/issues/290) [PR 1099](https://github.com/shakacode/react_on_rails/pull/1099) by [squadette](https://github.com/squadette). Merged in [PR 1107]( https://github.com/shakacode/react_on_rails/pull/1107).
27
+
28
+ ### [11.0.8] - 2018-06-15
29
+ #### Fixed
30
+ - HashWithIndifferent access for props threw if used for props. [PR 1100](https://github.com/shakacode/react_on_rails/pull/1100) by [justin808](https://github.com/justin808).
31
+ - Test helper for detecting stale bundles did not properly handle the case of a server-bundle.js without a hash.[PR 1102](https://github.com/shakacode/react_on_rails/pull/1102) by [justin808](https://github.com/justin808).
32
+ - Fix test helper determination of stale assets. [PR 1093](https://github.com/shakacode/react_on_rails/pull/1093) by [justin808](https://github.com/justin808).
33
+
34
+ #### Changed
35
+ - Document how to manually rehydrate XHR-substituted components on client side. [PR 1095](https://github.com/shakacode/react_on_rails/pull/1095) by [hchevalier](https://github.com/hchevalier).
36
+
37
+ ### [11.0.7] - 2018-05-16
38
+ #### Fixed
39
+ - Fix npm publshing. [PR 1090](https://github.com/shakacode/react_on_rails/pull/1090) by [justin808](https://github.com/justin808).
40
+
41
+ ### [11.0.6] - 2018-05-15
42
+ #### Changed
43
+ - Even more detailed errors for Honeybadger and Sentry when there's a JSON parse error on server rendering. [PR 1086](https://github.com/shakacode/react_on_rails/pull/1086) by [justin808](https://github.com/justin808).
44
+
45
+ ### [11.0.5] - 2018-05-11
46
+ #### Changed
47
+ - More detailed errors for Honeybadger and Sentry. [PR 1081](https://github.com/shakacode/react_on_rails/pull/1081) by [justin808](https://github.com/justin808).
48
+
49
+ ### [11.0.4] - 2018-05-3
50
+
51
+ #### Changed
52
+ - Throw if configuration.generated_assets_dir specified, and using webpacker, and if that doesn't match the public_output_path. Otherwise, warn if generated_assets_dir is specified
53
+ - Fix the setup for tests for spec/dummy so they automatically rebuild by correctly setting the source_path in the webpacker.yml
54
+ - Updated documentation for the testing setup.
55
+ - Above in [PR 1072](https://github.com/shakacode/react_on_rails/pull/1072) by [justin808](https://github.com/justin808).
56
+ - `react_component_hash` has implicit `prerender: true` because it makes no sense to have react_component_hash not use prerrender. Improved docs on `react_component_hash`. Also, fixed issue where checking gem existence. [PR 1077](https://github.com/shakacode/react_on_rails/pull/1077) by [justin808](https://github.com/justin808).
57
+
58
+ ### [11.0.3] - 2018-04-24
59
+
60
+ #### Fixed
61
+ - Fixed issue with component script initialization when using react_component_hash. [PR 1071](https://github.com/shakacode/react_on_rails/pull/1071) by [jblasco3](https://github.com/jblasco3).
62
+
63
+ ### [11.0.2] - 2018-04-24
64
+
65
+ #### Fixed
66
+ - Server rendering error for React on Rails Pro. [PR 1069](https://github.com/shakacode/react_on_rails/pull/1069) by [justin808](https://github.com/justin808).
67
+
68
+ ### [11.0.1] - 2018-04-23
69
+
70
+ #### Added
71
+ - `react_component` allows logging_on_server specified at the component level. [PR 1068](https://github.com/shakacode/react_on_rails/pull/1068) by [justin808](https://github.com/justin808).
72
+
73
+ #### Fixed
74
+ - Missing class when throwing some error messages. [PR 1068](https://github.com/shakacode/react_on_rails/pull/1068) by [justin808](https://github.com/justin808).
75
+
76
+ ### [11.0.0] - 2018-04-21
12
77
 
13
78
  ## MIGRATION for v11
14
79
  - Unused `server_render_method` was removed from the configuration. If you want to use a custom renderer, contact justin@shakacode.com. We have a custom node rendering solution in production for egghead.io.
15
80
  - Removed ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name. These are part of the performance features of "React on Rails Pro".
16
81
  - Removed ENV["TRACE_REACT_ON_RAILS"] usage and replacing it with config.trace.
17
82
 
18
- #### Enhanchements: Better Error Messages, Support for React on Rails Pro
83
+ #### Enhancements: Better Error Messages, Support for React on Rails Pro
19
84
  - Tracing (debugging) options are simplified with a single `config.trace` setting that defaults to true for development and false otherwise.
20
85
  - Calls to setTimeout, setInterval, clearTimeout will now always log some message if config.trace is true. Your JavaScript code should not be calling setTimout when server rendering.
21
86
  - Errors raised are of type ReactOnRailsError, so you can see they came from React on Rails for debugging.
22
87
  - Removed ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name.
23
88
  - No longer logging the `railsContext` when server logging.
24
89
  - Rails.env is provided in the default railsContext, as suggested in [issue #697](https://github.com/shakacode/react_on_rails/issues/697).
25
- [PR 1018](https://github.com/shakacode/react_on_rails/pull/1065) by [justin808](https://github.com/justin808).
90
+ [PR 1065](https://github.com/shakacode/react_on_rails/pull/1065) by [justin808](https://github.com/justin808).
26
91
 
27
92
  #### Fixes
28
93
  - More exact version checking. We keep the react_on_rails gem and the react-on-rails node package at
@@ -724,7 +789,19 @@ Best done with Object destructing:
724
789
  ##### Fixed
725
790
  - Fix several generator related issues.
726
791
 
727
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/10.1.4...master
792
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.1.0...master
793
+ [11.1.0]: https://github.com/shakacode/react_on_rails/compare/11.0.10...11.1.0
794
+ [11.0.10]: https://github.com/shakacode/react_on_rails/compare/11.0.9...11.0.10
795
+ [11.0.9]: https://github.com/shakacode/react_on_rails/compare/11.0.8...11.0.9
796
+ [11.0.8]: https://github.com/shakacode/react_on_rails/compare/11.0.7...11.0.8
797
+ [11.0.7]: https://github.com/shakacode/react_on_rails/compare/11.0.6...11.0.7
798
+ [11.0.6]: https://github.com/shakacode/react_on_rails/compare/11.0.5...11.0.6
799
+ [11.0.5]: https://github.com/shakacode/react_on_rails/compare/11.0.4...11.0.5
800
+ [11.0.4]: https://github.com/shakacode/react_on_rails/compare/11.0.3...11.0.4
801
+ [11.0.3]: https://github.com/shakacode/react_on_rails/compare/11.0.2...11.0.3
802
+ [11.0.2]: https://github.com/shakacode/react_on_rails/compare/11.0.1...11.0.2
803
+ [11.0.1]: https://github.com/shakacode/react_on_rails/compare/11.0.0...11.0.1
804
+ [11.0.0]: https://github.com/shakacode/react_on_rails/compare/10.1.4...11.0.0
728
805
  [10.1.4]: https://github.com/shakacode/react_on_rails/compare/10.1.3...10.1.4
729
806
  [10.1.3]: https://github.com/shakacode/react_on_rails/compare/10.1.2...10.1.3
730
807
  [10.1.2]: https://github.com/shakacode/react_on_rails/compare/10.1.1...10.1.2
data/CONTRIBUTING.md CHANGED
@@ -75,7 +75,7 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
75
75
  # Configuring your test app to use your local fork
76
76
  You can test the `react-on-rails` gem using your own external test app or the gem's internal `spec/dummy` app. The `spec/dummy` app is an example of the various setup techniques you can use with the gem.
77
77
  ```
78
- ├── test
78
+ ├── test_app
79
79
  | └── client
80
80
  └── react_on_rails
81
81
  └── spec
@@ -98,21 +98,20 @@ In addition to testing the Ruby parts out, you can also test the node package pa
98
98
  cd react_on_rails/
99
99
  yarn
100
100
  yarn run build
101
+ yarn install-react-on-rails
101
102
  ```
102
103
 
103
- Install the local package by using a relative path in your test/client app's `package.json`, like this:
104
+ Install the local package by using yarn link, like this:
104
105
  ```sh
105
- cd test/client
106
- rm -rf node_modules/react-on-rails && npm i 'file:../path-to-react-on-rails-top-package.json'
106
+ cd spec/dummy
107
+ yarn
107
108
  ```
108
- _Note: You must use npm here till yarn stops preferring cached packages over local. see [issue #2649](https://github.com/yarnpkg/yarn/issues/2649)_
109
109
 
110
- When you use a relative path, be sure to run the above `yarn` command whenever you change the node package for react-on-rails.
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.
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.
114
- 2. The "postinstall" script of "spec/dummy/client" calls "yarn link react-on-rails" to setup a sym link to the parent package.
115
- 3. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/spec/dummy` and navigate to `http://localhost:5000/`. You will now see the `Hello!` message printed in the browser's console.
114
+ 2. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/spec/dummy` and navigate to `http://localhost:5000/`. You will now see the `Hello!` message printed in the browser's console.
116
115
 
117
116
  _Note: running `npm i` automatically builds the npm package before installing. However, when using yarn you will need to run `yarn run build` in the root directory before the install script. This will be updated when [yarn issue #2649](https://github.com/yarnpkg/yarn/issues/2649) (above) is resolved._
118
117
 
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Justin Gordon and ShakaCode, http://www.shakacode.com
3
+ Copyright (c) 2017, 2018 Justin Gordon and ShakaCode, http://www.shakacode.com
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/PROJECTS.md CHANGED
@@ -11,6 +11,13 @@ April 11, 2018: 2138
11
11
 
12
12
  ## Commercial Products Live
13
13
  * **[Hawaii Chee](https://www.hawaiichee.com/)**, the signature product of [ShakaCode](http://www.shakacode.com), which is a vacation rental site focusing on Hawaii.
14
+ * **[RedFlagDeals](https://www.redflagdeals.com/)**, Canadian shopping site.
15
+ * **[YourMechanic](https://www.yourmechanic.com/)**, home calls for mechanics.
16
+ * **[Suntransfers](https://www.suntransfers.com/)**, airport car rides site.
17
+ * **[Decanter](http://www.decanter.com/)**, wine site.
18
+ * **[LocalWise](https://www.localwise.com/)**, local job site.
19
+ * **[Ellevest](https://www.ellevest.com/)**, investments for women.
20
+ * **[OppenheimerFunds](https://www.oppenheimerfunds.com/)**, investment site.
14
21
  * **[KissKissBankBank](https://www.kisskissbankbank.com/)**, large French crowdfunding platform.
15
22
  * **[HVMN](https://hvmn.com)**: Web ecommerce site for "biohacking" products.
16
23
  * **[GuavaPass](https://guavapass.com/)**: Coaching client of [ShakaCode](http://www.shakacode.com) and React on Rails fan!
@@ -27,7 +34,6 @@ April 11, 2018: 2138
27
34
  * **[Undeveloped](https://undeveloped.com/)**: Buy and sell domain names. ![image](https://cloud.githubusercontent.com/assets/1118459/19623703/7c6d63d0-9870-11e6-83f2-8b83ca49daa9.png)
28
35
  * **[Foxford.ru](http://foxford.ru/)**: Online School ![2016-12-17_13-23-21](https://cloud.githubusercontent.com/assets/1118459/21290377/1adacdf2-c45c-11e6-97c1-f726ab749b2d.png)
29
36
  * **[CareerBuilder for Employers](https://hiring.careerbuilder.com/)**: CareerBuilder's marketing/ecommerce website. We've integrated React on Rails and have deployed the application via Cloud 66, and are busy integrating this into other projects!
30
- * **[Josephine](https://www.josephine.com)**: The private network for home cooked meals.
31
37
  * **[first](https://first.io/)**: Data-driven Relational Marketing for Real Estate.
32
38
 
33
39
  ## Open Source Projects Live