react_on_rails 11.0.0 → 12.0.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 (130) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +320 -0
  3. data/.eslintignore +2 -1
  4. data/.eslintrc +30 -2
  5. data/.github/FUNDING.yml +1 -0
  6. data/.gitignore +3 -1
  7. data/.prettierignore +10 -0
  8. data/.prettierrc +23 -0
  9. data/.release-it.json +3 -0
  10. data/.rubocop.yml +39 -11
  11. data/.travis.yml +11 -22
  12. data/CHANGELOG.md +235 -6
  13. data/CONTRIBUTING.md +64 -84
  14. data/Gemfile +3 -5
  15. data/KUDOS.md +4 -1
  16. data/{docs/LICENSE.md → LICENSE.md} +1 -1
  17. data/PROJECTS.md +7 -1
  18. data/REACT-ON-RAILS-PRO-LICENSE +95 -0
  19. data/README.md +233 -630
  20. data/Rakefile +1 -5
  21. data/SUMMARY.md +42 -29
  22. data/book.json +5 -5
  23. data/docs/additional-reading/asset-pipeline.md +8 -16
  24. data/docs/additional-reading/convert-rails-5-api-only-app.md +19 -0
  25. data/docs/additional-reading/credits.md +10 -0
  26. data/docs/additional-reading/images.md +1 -1
  27. data/docs/additional-reading/rails-engine-integration.md +7 -0
  28. data/docs/additional-reading/rails_view_rendering_from_inline_javascript.md +2 -1
  29. data/docs/additional-reading/react-helmet.md +30 -10
  30. data/docs/additional-reading/react-router.md +52 -75
  31. data/docs/additional-reading/server-rendering-tips.md +14 -11
  32. data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +10 -0
  33. data/docs/additional-reading/webpack.md +2 -2
  34. data/docs/api/javascript-api.md +24 -4
  35. data/docs/api/redux-store-api.md +102 -0
  36. data/docs/api/view-helpers-api.md +133 -0
  37. data/docs/articles.md +20 -0
  38. data/docs/basics/client-vs-server-rendering.md +23 -0
  39. data/docs/basics/configuration.md +145 -61
  40. data/docs/basics/deployment.md +4 -0
  41. data/docs/basics/{generator.md → generator-details.md} +5 -8
  42. data/docs/basics/heroku-deployment.md +24 -0
  43. data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +49 -0
  44. data/docs/basics/i18n.md +45 -23
  45. data/docs/basics/installation-into-an-existing-rails-app.md +59 -0
  46. data/docs/basics/minitest-configuration.md +31 -0
  47. data/docs/basics/react-server-rendering.md +29 -0
  48. data/docs/{additional-reading → basics}/recommended-project-structure.md +38 -10
  49. data/docs/basics/render-functions-and-railscontext.md +205 -0
  50. data/docs/basics/rspec-configuration.md +73 -0
  51. data/docs/basics/upgrading-react-on-rails.md +75 -4
  52. data/docs/basics/webpack-configuration.md +50 -0
  53. data/docs/contributor-info/errors-with-hooks.md +45 -0
  54. data/docs/contributor-info/pull-requests.md +44 -0
  55. data/docs/misc/doctrine.md +2 -2
  56. data/docs/{additional-reading → outdated}/code-splitting.md +19 -9
  57. data/docs/outdated/how-react-on-rails-works.md +44 -0
  58. data/docs/{basics/installation-overview.md → outdated/manual-installation-overview.md} +8 -13
  59. data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
  60. data/docs/{additional-reading → outdated}/rails-assets.md +5 -13
  61. data/docs/testimonials/hvmn.md +25 -0
  62. data/docs/testimonials/resortpass.md +13 -0
  63. data/docs/testimonials/testimonials.md +28 -0
  64. data/docs/tutorial.md +182 -44
  65. data/jest.config.js +4 -0
  66. data/lib/generators/USAGE +1 -1
  67. data/lib/generators/react_on_rails/base_generator.rb +2 -2
  68. data/lib/generators/react_on_rails/dev_tests_generator.rb +3 -2
  69. data/lib/generators/react_on_rails/generator_helper.rb +4 -6
  70. data/lib/generators/react_on_rails/install_generator.rb +2 -0
  71. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +3 -1
  72. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +26 -0
  73. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -40
  74. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +4 -1
  75. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +4 -8
  76. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
  77. data/lib/react_on_rails/configuration.rb +175 -102
  78. data/lib/react_on_rails/error.rb +2 -0
  79. data/lib/react_on_rails/git_utils.rb +2 -0
  80. data/lib/react_on_rails/{react_on_rails_helper.rb → helper.rb} +201 -225
  81. data/lib/react_on_rails/json_output.rb +1 -1
  82. data/lib/react_on_rails/json_parse_error.rb +28 -0
  83. data/lib/react_on_rails/locales/base.rb +150 -0
  84. data/lib/react_on_rails/locales/to_js.rb +37 -0
  85. data/lib/react_on_rails/locales/to_json.rb +27 -0
  86. data/lib/react_on_rails/prerender_error.rb +56 -18
  87. data/lib/react_on_rails/react_component/render_options.rb +98 -0
  88. data/lib/react_on_rails/server_rendering_js_code.rb +42 -0
  89. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +139 -106
  90. data/lib/react_on_rails/server_rendering_pool.rb +4 -16
  91. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
  92. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +17 -0
  93. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +10 -6
  94. data/lib/react_on_rails/test_helper.rb +18 -7
  95. data/lib/react_on_rails/utils.rb +66 -26
  96. data/lib/react_on_rails/version.rb +1 -1
  97. data/lib/react_on_rails/version_checker.rb +5 -1
  98. data/lib/react_on_rails/version_syntax_converter.rb +14 -12
  99. data/lib/react_on_rails/webpacker_utils.rb +44 -10
  100. data/lib/react_on_rails.rb +8 -3
  101. data/lib/tasks/assets.rake +33 -46
  102. data/lib/tasks/locale.rake +4 -2
  103. data/package-scripts.yml +49 -0
  104. data/package.json +49 -40
  105. data/rakelib/dummy_apps.rake +1 -9
  106. data/rakelib/example_type.rb +3 -1
  107. data/rakelib/examples.rake +3 -0
  108. data/rakelib/lint.rake +2 -7
  109. data/rakelib/node_package.rake +2 -2
  110. data/rakelib/release.rake +4 -8
  111. data/rakelib/run_rspec.rake +5 -18
  112. data/react_on_rails.gemspec +5 -6
  113. data/tsconfig.json +14 -0
  114. data/webpackConfigLoader.js +5 -4
  115. data/yarn.lock +7645 -1821
  116. metadata +71 -61
  117. data/Gemfile.rails32 +0 -74
  118. data/docs/additional-reading/babel.md +0 -5
  119. data/docs/additional-reading/caching-and-performance.md +0 -4
  120. data/docs/additional-reading/heroku-deployment.md +0 -92
  121. data/docs/additional-reading/hot-reloading-rails-development.md +0 -57
  122. data/docs/additional-reading/node-server-rendering.md +0 -5
  123. data/docs/additional-reading/rspec-configuration.md +0 -56
  124. data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
  125. data/docs/api/ruby-api.md +0 -8
  126. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
  127. data/lib/react_on_rails/assets_precompile.rb +0 -150
  128. data/lib/react_on_rails/locales_to_js.rb +0 -134
  129. data/lib/react_on_rails/react_component/options.rb +0 -64
  130. /data/docs/{misc → outdated}/rails3.md +0 -0
data/CHANGELOG.md CHANGED
@@ -1,28 +1,230 @@
1
1
  # Change Log
2
2
  All notable changes to this project's source code will be documented in this file. Items under `Unreleased` is upcoming features that will be out in next version. NOTE: major versions of the npm module and the gem must be kept in sync.
3
3
 
4
- Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.
4
+ Migration instructions for the major updates can be found [here](docs/basics/upgrading-react-on-rails.md#upgrading-to-version-9.md). Some smaller migration information can be found here.
5
5
 
6
- See [Upgrading React on Rails](./docs/basics/upgrading-react-on-rails.md) for more concise instructions on upgrading.
6
+ ## Need Help Migrating?
7
+ If you would like help in migrating between React on Rails versions or help with implementing server rendering, please contact [justin@shakacode.com](mailto:justin@shakacode.com) for information about our [React on Rails Pro Support Options](https://www.shakacode.com/react-on-rails-pro).
8
+
9
+ 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.
10
+
11
+ ## Contributors
12
+ Please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.
7
13
 
8
14
  ## [Unreleased]
9
15
  Changes since last non-beta release.
10
16
 
11
17
  *Please add entries here for your pull requests that are not yet released.*
12
18
 
19
+ ## UPCOMING 12.0 RELEASE
20
+ See [docs/basics/upgrading-react-on-rails.md](./docs/basics/upgrading-react-on-rails.md).
21
+
22
+ ### [12.0.0.pre.beta.2]
23
+ * Changed the precompile task to use the rails/webpacker one by default
24
+
25
+ ### [12.0.0.pre.beta.1]
26
+ * Updated generators to use React hooks
27
+
28
+ ### [12.0.0.pre.beta.0]
29
+ Gem version: 12.0.0.pre.beta.0 and npm version 12.0.0-beta.0 released! Please try this out!
30
+
31
+ #### BREAKING CHANGE
32
+ In order to solve the issues regarding React Hooks compatibility, the number of parameters
33
+ for functions is used to determine if you have a generator function that will get invoked to
34
+ return a React component, or you are registering a functional React component. Alternately, you can
35
+ set JavaScript property `renderFunction` on the function for which you want to return to be
36
+ invoked to return the React component. In that case, you won't need to pass any unused params.
37
+ [PR 1268](https://github.com/shakacode/react_on_rails/pull/1268) by [justin808](https://github.com/justin808)
38
+
39
+ See [docs/basics/upgrading-react-on-rails](./docs/basics/upgrading-react-on-rails.md#upgrading-to-v12)
40
+ for details.
41
+
42
+ * Requires the use of rails/webpacker helpers
43
+ * If the webpacker webpack config files exist, then React on Rails will not override the default
44
+ assets:precompile setup by rails/webpacker. The fix is to remove the JS files inside of config/webpack,
45
+ like config/webpack/production.js.
46
+ * Removed **env_javascript_include_tag** and **env_stylesheet_link_tag** as these are replaced by view helpers
47
+ from rails/webpacker
48
+ * Removal of support for old Rubies and Rails.
49
+ * Removal of config.symlink_non_digested_assets_regex as it's no longer needed with rails/webpacker.
50
+ If any business needs this, we can move the code to a separate gem.
51
+ * Added configuration option `same_bundle_for_client_and_server` with default `false` because
52
+
53
+ 1. Production applications would typically have a server bundle that differs from the client bundle
54
+ 2. This change only affects trying to use HMR with react_on_rails with rails/webpacker.
55
+
56
+ The previous behavior was to always go to the webpack-dev-server for the server bundle if the
57
+ webpack-dev-server was running _and_ the server bundle was found in the `manifest.json`.
58
+
59
+ If you are using the **same bundle for client and server rendering**, then set this configuration option
60
+ to `true`. By [justin808](https://github.com/shakacode/react_on_rails/pull/1240).
61
+
62
+ * Added support to export locales in JSON format. New option added `i18n_output_format` which allows to
63
+ specify locales format either `JSON` or `JS`. **`JSON` format is now the default.**
64
+
65
+ Use this config setting to get the old behavior: config.i18n_output_format = 'js'
66
+
67
+ [PR 1271](https://github.com/shakacode/react_on_rails/pull/1271) by [ashgaliyev](https://github.com/ashgaliyev).
68
+
69
+ #### Improved
70
+ - Added Typescript definitions to the Node package. By [justin808](https://github.com/justin808) and [judahmeek](https://github.com/judahmeek) in [PR 1287](https://github.com/shakacode/react_on_rails/pull/1287).
71
+ - Removed unnecessary restriction to keep the server bundle in the same directory with the client bundles. Rails/webpacker 4 has an advanced cleanup that will remove any files in the directory of other webpack files. Removing this restriction allows the server bundle to be created in a sibling directory. By [justin808](https://github.com/shakacode/react_on_rails/pull/1240).
72
+
73
+ ### [11.3.0] - 2019-05-24
74
+ #### Added
75
+ - Added method for retrieving any option from `render_options` [PR 1213](https://github.com/shakacode/react_on_rails/pull/1213)
76
+ by [ashgaliyev](https://github.com/ashgaliyev).
77
+
78
+ - html_options has an option for 'tag' to set the html tag name like this: `html_options: { tag: "span" }`.
79
+ [PR 1208](https://github.com/shakacode/react_on_rails/pull/1208) by [tahsin352](https://github.com/tahsin352).
80
+
81
+ ### [11.2.2] - 2018-12-24
82
+ #### Improved
83
+ - rails_context can more easily be called from controller methods. The mandatory param of server_side has been made optional.
84
+
85
+ ### [11.2.1] - 2018-12-06
86
+ ## MIGRATION for v11.2
87
+ - If using **React on Rails Pro**, upgrade react_on_rails_pro to a version >= 1.3.
88
+
89
+ #### Improved
90
+ - 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).
91
+
92
+ - 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).
93
+
94
+ #### Changed
95
+ - Changed the default for:
96
+ ```rb
97
+ config.raise_on_prerender_error = Rails.env.development?
98
+ ```
99
+
100
+ Thus, developers will need to fix server rendering errors before continuing.
101
+ [PR 1145](https://github.com/shakacode/react_on_rails/pull/1145) by [justin808](https://github.com/justin808).
102
+
103
+ ### 11.2.0 - 2018-12-06
104
+ Do not use. Unpublished. Caused by an issue with the release script.
105
+
106
+ ### [11.1.8] - 2018-10-14
107
+
108
+ #### Improved
109
+ - Improved tutorial and support for HMR when using `rails/webpacker` for Webpack configuration. [PR 1156](https://github.com/shakacode/react_on_rails/pull/1156) by [justin808](https://github.com/justin808).
110
+
111
+ ### [11.1.7] - 2018-10-10
112
+ #### Fixed
113
+ - Fixed bug where intl parsing would fail when trying to parse integers or blank entries. by [sepehr500](https://github.com/sepehr500)
114
+
115
+ ### [11.1.6] - 2018-10-05
116
+ #### Fixed
117
+ - Fix client startup invoking render prematurely, **AGAIN**. Fix additional cases of client startup failing during interactive readyState". Closes [issue #1150](https://github.com/shakacode/react_on_rails/issues/1150). [PR 1152](https://github.com/shakacode/react_on_rails/pull/1152) by [rakelley](https://github.com/rakelley).
118
+
119
+ ### [11.1.5] - 2018-10-03
120
+ #### Fixed
121
+ - Fix client startup invoking render prematurely. Closes [issue #1150](https://github.com/shakacode/react_on_rails/issues/1150). [PR 1151](https://github.com/shakacode/react_on_rails/pull/1151) by [rakelley](https://github.com/rakelley).
122
+
123
+ ### [11.1.4] - 2018-09-12
124
+
125
+ #### Fixed
126
+ - Ignore Arrays in Rails i18n yml files. [PR 1129](https://github.com/shakacode/react_on_rails/pull/1129) by [vcarel](https://github.com/vcarel).
127
+ - Fix to apply transform-runtime. And work with Babel 6 and 7. (Include revert of [PR 1136](https://github.com/shakacode/react_on_rails/pull/1136)) [PR 1140](https://github.com/shakacode/react_on_rails/pull/1140) by [Ryunosuke Sato](https://github.com/tricknotes).
128
+ - Upgrade Babel version to 7 [PR 1141](https://github.com/shakacode/react_on_rails/pull/1141) by [Ryunosuke Sato](https://github.com/tricknotes).
129
+
130
+ ### [11.1.3] - 2018-08-26
131
+
132
+ #### Fixed
133
+ - Don't apply babel-plugin-transform-runtime inside react-on-rails to work with babel 7. [PR 1136](https://github.com/shakacode/react_on_rails/pull/1136) by [Ryunosuke Sato](https://github.com/tricknotes).
134
+ - Add support for webpacker 4 prereleases. [PR 1134](https://github.com/shakacode/react_on_rails/pull/1134) by [Judahmeek](https://github.com/Judahmeek))
135
+
136
+ ### [11.1.2] - 2018-08-18
137
+
138
+ #### Fixed
139
+ - Tests now properly exit if the config.build_test_command fails!
140
+ - Source path for project using Webpacker would default to "app/javascript" even if when the node_modules
141
+ directory was set to "client". Fix now makes the configuration of this crystal clear.
142
+ - renamed method RenderOptions.has_random_dom_id? to RenderOptions.random_dom_id? for rubocop rule.
143
+ [PR 1133](https://github.com/shakacode/react_on_rails/pull/1133) by [justin808](https://github.com/justin808)
144
+
145
+ ### [11.1.1] - 2018-08-09
146
+ #### Fixed
147
+ - `TRUE` was deprecated in ruby 2.4, using `true` instead. [PR 1128](https://github.com/shakacode/react_on_rails/pull/1128) by [Aguardientico](https://github.com/Aguardientico).
148
+
149
+ ### [11.1.0] - 2018-08-07
150
+ #### Added
151
+ - 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. [PR 1121](https://github.com/shakacode/react_on_rails/pull/1121) by [justin808](https://github.com/justin808)
152
+ * Added configuration option random_dom_id
153
+ * Added method RenderOptions has_random_dom_id?
154
+ #### Fixed
155
+ - Fix invalid warn directive. [PR 1123](https://github.com/shakacode/react_on_rails/pull/1123) by [mustangostang](https://github.com/mustangostang).
156
+
157
+ ### [11.0.10] - 2018-07-22
158
+ #### Fixed
159
+ - 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).
160
+ - Properly clearing hydrated stores when server rendering. [PR 1120](https://github.com/shakacode/react_on_rails/pull/1120) by [squadette](https://github.com/squadette).
161
+
162
+ ### [11.0.9] - 2018-06-24
163
+ - 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).
164
+
165
+ ### [11.0.8] - 2018-06-15
166
+ #### Fixed
167
+ - 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).
168
+ - 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).
169
+ - Fix test helper determination of stale assets. [PR 1093](https://github.com/shakacode/react_on_rails/pull/1093) by [justin808](https://github.com/justin808).
170
+
171
+ #### Changed
172
+ - 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).
173
+
174
+ ### [11.0.7] - 2018-05-16
175
+ #### Fixed
176
+ - Fix npm publshing. [PR 1090](https://github.com/shakacode/react_on_rails/pull/1090) by [justin808](https://github.com/justin808).
177
+
178
+ ### [11.0.6] - 2018-05-15
179
+ #### Changed
180
+ - 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).
181
+
182
+ ### [11.0.5] - 2018-05-11
183
+ #### Changed
184
+ - More detailed errors for Honeybadger and Sentry. [PR 1081](https://github.com/shakacode/react_on_rails/pull/1081) by [justin808](https://github.com/justin808).
185
+
186
+ ### [11.0.4] - 2018-05-3
187
+
188
+ #### Changed
189
+ - 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
190
+ - Fix the setup for tests for spec/dummy so they automatically rebuild by correctly setting the source_path in the webpacker.yml
191
+ - Updated documentation for the testing setup.
192
+ - Above in [PR 1072](https://github.com/shakacode/react_on_rails/pull/1072) by [justin808](https://github.com/justin808).
193
+ - `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).
194
+
195
+ ### [11.0.3] - 2018-04-24
196
+
197
+ #### Fixed
198
+ - 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).
199
+
200
+ ### [11.0.2] - 2018-04-24
201
+
202
+ #### Fixed
203
+ - 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).
204
+
205
+ ### [11.0.1] - 2018-04-23
206
+
207
+ #### Added
208
+ - `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).
209
+
210
+ #### Fixed
211
+ - Missing class when throwing some error messages. [PR 1068](https://github.com/shakacode/react_on_rails/pull/1068) by [justin808](https://github.com/justin808).
212
+
213
+ ### [11.0.0] - 2018-04-21
214
+
13
215
  ## MIGRATION for v11
14
216
  - 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
217
  - 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
218
  - Removed ENV["TRACE_REACT_ON_RAILS"] usage and replacing it with config.trace.
17
219
 
18
- #### Enhanchements: Better Error Messages, Support for React on Rails Pro
220
+ #### Enhancements: Better Error Messages, Support for React on Rails Pro
19
221
  - Tracing (debugging) options are simplified with a single `config.trace` setting that defaults to true for development and false otherwise.
20
- - 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.
222
+ - 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
223
  - Errors raised are of type ReactOnRailsError, so you can see they came from React on Rails for debugging.
22
224
  - Removed ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name.
23
225
  - No longer logging the `railsContext` when server logging.
24
226
  - 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).
227
+ [PR 1065](https://github.com/shakacode/react_on_rails/pull/1065) by [justin808](https://github.com/justin808).
26
228
 
27
229
  #### Fixes
28
230
  - More exact version checking. We keep the react_on_rails gem and the react-on-rails node package at
@@ -724,7 +926,34 @@ Best done with Object destructing:
724
926
  ##### Fixed
725
927
  - Fix several generator related issues.
726
928
 
727
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/10.1.4...master
929
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.0.0-beta.3...master
930
+ [12.0.0.pre.beta.3]: https://github.com/shakacode/react_on_rails/compare/12.0.0-beta.2...12.0.0-beta.3
931
+ [12.0.0.pre.beta.2]: https://github.com/shakacode/react_on_rails/compare/12.0.0-beta.1...12.0.0-beta.2
932
+ [12.0.0.pre.beta.1]: https://github.com/shakacode/react_on_rails/compare/12.0.0-beta.0...12.0.0-beta.1
933
+ [12.0.0.pre.beta.0]: https://github.com/shakacode/react_on_rails/compare/11.3.0...12.0.0-beta.0
934
+ [11.3.0]: https://github.com/shakacode/react_on_rails/compare/11.2.2...11.3.0
935
+ [11.2.2]: https://github.com/shakacode/react_on_rails/compare/11.2.1...11.2.2
936
+ [11.2.1]: https://github.com/shakacode/react_on_rails/compare/11.1.8...11.2.1
937
+ [11.1.8]: https://github.com/shakacode/react_on_rails/compare/11.1.7...11.1.8
938
+ [11.1.7]: https://github.com/shakacode/react_on_rails/compare/11.1.6...11.1.7
939
+ [11.1.6]: https://github.com/shakacode/react_on_rails/compare/11.1.5...11.1.6
940
+ [11.1.5]: https://github.com/shakacode/react_on_rails/compare/11.1.4...11.1.5
941
+ [11.1.4]: https://github.com/shakacode/react_on_rails/compare/11.1.3...11.1.4
942
+ [11.1.3]: https://github.com/shakacode/react_on_rails/compare/11.1.2...11.1.3
943
+ [11.1.2]: https://github.com/shakacode/react_on_rails/compare/11.1.1...11.1.2
944
+ [11.1.1]: https://github.com/shakacode/react_on_rails/compare/11.1.0...11.1.1
945
+ [11.1.0]: https://github.com/shakacode/react_on_rails/compare/11.0.10...11.1.0
946
+ [11.0.10]: https://github.com/shakacode/react_on_rails/compare/11.0.9...11.0.10
947
+ [11.0.9]: https://github.com/shakacode/react_on_rails/compare/11.0.8...11.0.9
948
+ [11.0.8]: https://github.com/shakacode/react_on_rails/compare/11.0.7...11.0.8
949
+ [11.0.7]: https://github.com/shakacode/react_on_rails/compare/11.0.6...11.0.7
950
+ [11.0.6]: https://github.com/shakacode/react_on_rails/compare/11.0.5...11.0.6
951
+ [11.0.5]: https://github.com/shakacode/react_on_rails/compare/11.0.4...11.0.5
952
+ [11.0.4]: https://github.com/shakacode/react_on_rails/compare/11.0.3...11.0.4
953
+ [11.0.3]: https://github.com/shakacode/react_on_rails/compare/11.0.2...11.0.3
954
+ [11.0.2]: https://github.com/shakacode/react_on_rails/compare/11.0.1...11.0.2
955
+ [11.0.1]: https://github.com/shakacode/react_on_rails/compare/11.0.0...11.0.1
956
+ [11.0.0]: https://github.com/shakacode/react_on_rails/compare/10.1.4...11.0.0
728
957
  [10.1.4]: https://github.com/shakacode/react_on_rails/compare/10.1.3...10.1.4
729
958
  [10.1.3]: https://github.com/shakacode/react_on_rails/compare/10.1.2...10.1.3
730
959
  [10.1.2]: https://github.com/shakacode/react_on_rails/compare/10.1.1...10.1.2
data/CONTRIBUTING.md CHANGED
@@ -1,46 +1,9 @@
1
1
  # Tips for Contributors
2
2
 
3
- * See [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
3
+ * [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
4
+ * [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md)
4
5
  * See other docs in [docs/contributor-info](./docs/contributor-info)
5
6
 
6
- ## Summary
7
-
8
- For non-doc fixes:
9
-
10
- * Provide changelog entry in the [unreleased section of the CHANGELOG.md](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#unreleased).
11
- * Ensure CI passes and that you added a test that passes with the fix and fails without the fix.
12
- * Squash all commits down to one with a nice commit message *ONLY* once final review is given. Make sure this single commit is rebased on top of master.
13
- * Please address all code review comments.
14
- * Ensure that docs are updated accordingly if a feature is added.
15
-
16
- ## Commit Messages
17
-
18
- From [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/)
19
-
20
- #### The seven rules of a great git commit message
21
- > Keep in mind: This has all been said before.
22
-
23
- 1. Separate subject from body with a blank line
24
- 1. Limit the subject line to 50 characters
25
- 1. Capitalize the subject line
26
- 1. Do not end the subject line with a period
27
- 1. Use the imperative mood in the subject line
28
- 1. Wrap the body at 72 characters
29
- 1. Use the body to explain what and why vs. how
30
-
31
-
32
- ## Doc Changes
33
-
34
- When making doc changes, we want the change to work on both the gitbook and the regular github site. The issue is that non-doc files will not go to the gitbook site, so doc references to non doc files must use the github URL.
35
-
36
- ### Links to other docs:
37
- * When making references to doc files, use a relative URL path like:
38
- `[Installation Overview](docs/basics/installation-overview.md)`
39
-
40
- * When making references to source code files, use a full url path like:
41
- `[spec/dummy/config/initializers/react_on_rails.rb](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/initializers/react_on_rails.rb)`
42
-
43
-
44
7
  ## To run tests:
45
8
  * After updating code via git, to prepare all examples and run all tests:
46
9
 
@@ -75,7 +38,7 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
75
38
  # Configuring your test app to use your local fork
76
39
  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
40
  ```
78
- ├── test
41
+ ├── test_app
79
42
  | └── client
80
43
  └── react_on_rails
81
44
  └── spec
@@ -91,61 +54,63 @@ gem "react_on_rails", path: "../path-to-react-on-rails"
91
54
 
92
55
  Note that you will need to bundle install after making this change, but also that **you will need to restart your Rails application if you make any changes to the gem**.
93
56
 
94
- ## Testing the Node package for react-on-rails
57
+ ## Testing the Node package for react-on-rails via Yalc
95
58
  In addition to testing the Ruby parts out, you can also test the node package parts of the gem with an external application. First, be **sure** to build the NPM package:
96
59
 
97
60
  ```sh
98
61
  cd react_on_rails/
99
62
  yarn
100
- yarn run build
63
+
64
+ # Update the lib directory with babel compiled files
65
+ yarn run build:watch
101
66
  ```
67
+
68
+ You need to do this once:
102
69
 
103
- Install the local package by using a relative path in your test/client app's `package.json`, like this:
104
- ```sh
105
- cd test/client
106
- rm -rf node_modules/react-on-rails && npm i 'file:../path-to-react-on-rails-top-package.json'
107
70
  ```
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)_
71
+ # Will send the updates to other folders
72
+ yalc publish
73
+ cd spec/dummy
74
+ yalc add react-on-rails
75
+ ```
109
76
 
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.
77
+ The workflow is:
78
+ 1. Make changes to the node package.
79
+ 2. We need yalc to push and then run yarn:
80
+ ```
81
+ cd <top dir>
82
+ # Will send the updates to other folders
83
+ yalc push
84
+ cd spec/dummy
111
85
 
112
- #### Example: Testing NPM changes with the dummy app
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.
86
+ # Will update from yalc
87
+ yarn
88
+ ```
116
89
 
117
- _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._
90
+ When you run `yalc push`, you'll get an informative message
118
91
 
119
- # Development Setup for Gem and Node Package Contributors
92
+ ```
93
+ ✗ yalc push
94
+ react-on-rails@12.0.0-12070fd1 published in store.
95
+ Pushing react-on-rails@12.0.0 in /Users/justin/shakacode/react-on-rails/react_on_rails/spec/dummy
96
+ Package react-on-rails@12.0.0-12070fd1 added ==> /Users/justin/shakacode/react-on-rails/react_on_rails/spec/dummy/node_modules/react-on-rails.
97
+ Don't forget you may need to run yarn after adding packages with yalc to install/update dependencies/bin scripts.
98
+ ```
120
99
 
121
- ## Checklist before Committing
122
- 1. `rake`: runs all linters and specs (you need Docker setup, see below)
123
- 2. Did you need any more tests for your change?
124
- 3. Did you document your change? Update the README.md?
100
+ #### Example: Testing NPM changes with the dummy app
101
+ 1. Add `console.log('Hello!')` to [clientStartup.ts, function render](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/clientStartup.ts in `/node_package/src/clientStartup.js` to confirm we're getting an update to the node package client side. Do the same for function `serverRenderReactComponent` in `/node_package/src/serverRenderReactComponent.ts`.
102
+ 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. If you did not see that message, then review the steps above for the workflow of making changes and pushing them via yalc.
103
+
104
+ # Development Setup for Gem and Node Package Contributors
125
105
 
126
106
  ## Dev Initial Setup
127
107
 
128
108
  ### Prereqs
129
109
  After checking out the repo, making sure you have rvm and nvm setup (setup ruby and node), cd to `spec/dummy` and run `bin/setup` to install ruby dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
130
110
 
131
- Additionally, our RSpec tests use the poltergeist web driver. You will need to install the phantomjs node module:
132
-
133
- ```sh
134
- yarn global add phantomjs-prebuilt
135
- ```
136
-
137
- Note this *must* be installed globally for the dummy test project rspec runner to see it properly.
138
-
139
111
  ### Local Node Package
140
- Because the example and dummy apps rely on the react-on-rails node package, they should link directly to your local version to pick up any changes you may have made to that package. To achieve this, switch to the dummy app's root directory and run this command below which runs something like [this script](spec/dummy/package.json#L14)
141
112
 
142
- ```sh
143
- cd react_on_rails/spec/dummy
144
- yarn run install-react-on-rails
145
- ```
146
- _Note: this runs npm under the hood as explained in **Test NPM for react-on-rails** section above_
147
-
148
- From now on, the example and dummy apps will use your local node_package folder as the react-on-rails node package. This will also be done automatically for you via the `rake examples:gen_all` rake task.
113
+ Note, the example and dummy apps will use your local node_package folder as the react-on-rails node package. This will also be done automatically for you via the `rake examples:gen_all` rake task.
149
114
 
150
115
  *Side note: It's critical to use the alias section of the webpack config to avoid a double inclusion error. This has already been done for you in the example and dummy apps, but for reference:*
151
116
 
@@ -172,7 +137,7 @@ spec/dummy.
172
137
 
173
138
  ```sh
174
139
  # Optionally change default selenium_firefox driver
175
- export DRIVER=poltergeist
140
+ export DRIVER=selenium_firefox
176
141
  cd react_on_rails/
177
142
  yarn run dummy:spec
178
143
  ```
@@ -191,13 +156,6 @@ cd react_on_rails/spec/dummy
191
156
  rspec
192
157
  ```
193
158
 
194
- Eventually, we may have JS tests:
195
-
196
- ```sh
197
- cd react_on_rails/spec/dummy/client
198
- yarn run test
199
- ```
200
-
201
159
  ### Run most tests and linting
202
160
 
203
161
  ```sh
@@ -206,7 +164,7 @@ yarn run check
206
164
  ```
207
165
 
208
166
  ### Starting the Dummy App
209
- To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start`. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
167
+ To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start` with one of the Procfiles. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
210
168
 
211
169
  ### RSpec Testing
212
170
  Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.
@@ -228,10 +186,26 @@ In your Rails app add this gem with a path to your fork.
228
186
 
229
187
  ```ruby
230
188
  gem 'react_on_rails', path: '../relative/path/to/react_on_rails'
231
- ```
189
+ ```
190
+
191
+ Then run `bundle`.
232
192
 
233
193
  The main installer can be run with ```rails generate react_on_rails:install```
234
194
 
195
+ Then use yalc to add the npm module.
196
+
197
+ Be sure that your ran this first at the top level of React on Rails
198
+
199
+ ```
200
+ yalc publish
201
+ ```
202
+
203
+ Then add the node package to your test app:
204
+
205
+ ```
206
+ yalc add react-on-rails
207
+ ```
208
+
235
209
  ### Testing the Generator
236
210
  The generators are covered by generator tests using Rails's generator testing helpers, but it never hurts to do a sanity check and explore the API. See [generator_testing_script.md](generator_testing_script.md) for a script on how to run the generator on a fresh project.
237
211
 
@@ -256,6 +230,12 @@ You can run specific linting for directories or files by using `docker-compose r
256
230
 
257
231
  `docker-compose run lint bash` sets you up to run from the container command line.
258
232
 
233
+ ### Updating Rubocop
234
+ 2 files require updating to update the Rubocop version:
235
+
236
+ 1. `react_on_rails.gemspec`
237
+ 2. `spec/dummy/Gemfile`
238
+
259
239
  ### Docker CI - Test and Linting
260
240
  Docker CI and Tests containers have a xvfd server automatically started for headless browser testing with selenium and Firefox.
261
241
 
data/Gemfile CHANGED
@@ -15,14 +15,14 @@ gem "jbuilder"
15
15
  gem "jquery-rails"
16
16
  gem "mini_racer"
17
17
  gem "puma"
18
-
19
18
  gem "rails_12factor"
20
19
  gem "ruby-lint", require: false
21
20
  gem "sass-rails"
22
21
  gem "scss_lint", require: false
23
22
  gem "sdoc", group: :doc
24
23
  gem "spring"
25
- gem "sqlite3"
24
+ gem "sprockets", "~>3.0"
25
+ gem "sqlite3", "~> 1.3.6"
26
26
  gem "turbolinks"
27
27
  gem "uglifier"
28
28
  gem "web-console", group: :development
@@ -30,13 +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
- gem "poltergeist"
36
34
  gem "rspec-rails"
37
35
  gem "rspec-retry"
38
36
  gem "selenium-webdriver"
39
- gem "webpacker"
37
+ gem "webpacker", ">= 4.0.0"
40
38
 
41
39
  gem "equivalent-xml", github: "mbklein/equivalent-xml"
42
40
  gem "rainbow"
data/KUDOS.md CHANGED
@@ -2,11 +2,14 @@ This is a sibling file to [PROJECTS.md](./PROJECTS.md).
2
2
 
3
3
  I'm looking for quotes on why you like using React on Rails. You might mention any benefits you particularly like and if you've migrated from react-rails. Just click to edit and github will automatically open up a PR. Thanks to everybody that contributes!
4
4
 
5
+ ## September 23, 2018, [#1148](https://github.com/shakacode/react_on_rails/issues/1148#issue-363039856).
6
+
7
+ ![2018-09-26_22-17-28](https://user-images.githubusercontent.com/1118459/46132537-ffe40e00-c1d9-11e8-8bbc-868370fcb8f9.png)
8
+
5
9
  ## September 20, 2017, By [ShakaCode Forum](https://forum.shakacode.com/t/new-ror-users-inbound/1014)
6
10
 
7
11
  ![2017-10-07_00-18-43](https://user-images.githubusercontent.com/1118459/31306902-341a537a-aaf5-11e7-8014-28c126a7c975.png)
8
12
 
9
-
10
13
  ## June 9, 2017
11
14
  By Github Issue [#868](https://github.com/shakacode/react_on_rails/issues/868)
12
15
 
@@ -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