react_on_rails 12.0.5.beta.0 → 12.4.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +23 -11
  3. data/.eslintrc +2 -0
  4. data/.prettierrc +0 -3
  5. data/.rubocop.yml +40 -2
  6. data/CHANGELOG.md +56 -26
  7. data/CONTRIBUTING.md +3 -2
  8. data/Gemfile.development_dependencies +4 -3
  9. data/NEWS.md +9 -4
  10. data/README.md +28 -323
  11. data/Rakefile +1 -1
  12. data/SUMMARY.md +12 -12
  13. data/docs/{basics → additional-details}/generator-details.md +1 -6
  14. data/docs/{outdated → additional-details}/manual-installation-overview.md +6 -6
  15. data/docs/{basics → additional-details}/migrating-from-react-rails.md +0 -0
  16. data/docs/{additional-reading → additional-details}/recommended-project-structure.md +0 -0
  17. data/docs/{additional-reading → additional-details}/updating-dependencies.md +0 -0
  18. data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +10 -0
  19. data/docs/api/javascript-api.md +2 -2
  20. data/docs/api/redux-store-api.md +3 -3
  21. data/docs/api/view-helpers-api.md +7 -8
  22. data/docs/contributor-info/linters.md +5 -6
  23. data/docs/contributor-info/pull-requests.md +2 -4
  24. data/docs/contributor-info/releasing.md +1 -1
  25. data/docs/{additional-reading → deployment}/elastic-beanstalk.md +0 -0
  26. data/docs/{basics → deployment}/heroku-deployment.md +0 -0
  27. data/docs/{basics → guides}/client-vs-server-rendering.md +3 -3
  28. data/docs/{basics → guides}/configuration.md +45 -25
  29. data/docs/guides/deployment.md +4 -0
  30. data/docs/guides/getting-started.md +183 -0
  31. data/docs/{basics → guides}/hmr-and-hot-reloading-with-the-webpack-dev-server.md +0 -0
  32. data/docs/{outdated → guides}/how-react-on-rails-works.md +9 -8
  33. data/docs/guides/how-to-conditionally-server-render-based-on-device-type.md +39 -0
  34. data/docs/guides/how-to-use-different-files-for-client-and-server-rendering.md +98 -0
  35. data/docs/{basics → guides}/i18n.md +0 -0
  36. data/docs/{basics → guides}/installation-into-an-existing-rails-app.md +3 -3
  37. data/docs/{basics → guides}/minitest-configuration.md +0 -0
  38. data/docs/guides/rails-webpacker-react-integration-options.md +182 -0
  39. data/docs/guides/react-on-rails-overview.md +30 -0
  40. data/docs/{basics → guides}/react-server-rendering.md +3 -3
  41. data/docs/{basics → guides}/render-functions-and-railscontext.md +0 -0
  42. data/docs/{basics → guides}/rspec-configuration.md +10 -10
  43. data/docs/{tutorial.md → guides/tutorial.md} +9 -11
  44. data/docs/{basics → guides}/upgrading-react-on-rails.md +7 -7
  45. data/docs/{basics → guides}/webpack-configuration.md +4 -6
  46. data/docs/home.md +23 -0
  47. data/docs/{additional-reading → javascript}/angular-js-integration-migration.md +0 -0
  48. data/docs/{additional-reading → javascript}/asset-pipeline.md +0 -0
  49. data/docs/{additional-reading → javascript}/capistrano-deployment.md +0 -0
  50. data/docs/{outdated → javascript}/code-splitting.md +3 -3
  51. data/docs/{additional-reading → javascript}/converting-from-custom-webpack-config-to-rails-webpacker-config.md +3 -3
  52. data/docs/{additional-reading → javascript}/credits.md +0 -0
  53. data/docs/{additional-reading → javascript}/foreman-issues.md +0 -0
  54. data/docs/{additional-reading → javascript}/images.md +5 -6
  55. data/docs/{additional-reading → javascript}/node-dependencies-and-npm.md +0 -0
  56. data/docs/{additional-reading → javascript}/react-and-redux.md +0 -0
  57. data/docs/{additional-reading → javascript}/react-helmet.md +0 -0
  58. data/docs/{additional-reading → javascript}/react-router.md +0 -0
  59. data/docs/{additional-reading → javascript}/server-rendering-tips.md +0 -0
  60. data/docs/{additional-reading → javascript}/troubleshooting-when-using-webpacker.md +0 -0
  61. data/docs/{additional-reading → javascript}/webpack-v1-notes.md +0 -0
  62. data/docs/{additional-reading → javascript}/webpack.md +0 -0
  63. data/docs/{articles.md → misc/articles.md} +1 -1
  64. data/docs/misc/doctrine.md +5 -5
  65. data/docs/{coding-style → misc}/style.md +0 -0
  66. data/docs/{additional-reading → misc}/tips.md +0 -0
  67. data/docs/outdated/deferred-rendering.md +39 -0
  68. data/docs/outdated/rails-assets-relative-paths.md +3 -3
  69. data/docs/outdated/rails-assets.md +8 -8
  70. data/docs/outdated/rails3.md +2 -2
  71. data/docs/{additional-reading → rails}/convert-rails-5-api-only-app.md +1 -1
  72. data/docs/{additional-reading → rails}/rails-engine-integration.md +3 -12
  73. data/docs/{additional-reading → rails}/rails_view_rendering_from_inline_javascript.md +0 -0
  74. data/docs/{additional-reading → rails}/turbolinks.md +13 -1
  75. data/docs/react-on-rails-pro/react-on-rails-pro.md +43 -0
  76. data/docs/testimonials/testimonials.md +6 -6
  77. data/lib/generators/react_on_rails/base_generator.rb +1 -1
  78. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
  79. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +4 -1
  80. data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb +2 -2
  81. data/lib/react_on_rails/helper.rb +26 -2
  82. data/lib/react_on_rails/locales/base.rb +7 -9
  83. data/lib/react_on_rails/react_component/render_options.rb +16 -7
  84. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +11 -0
  85. data/lib/react_on_rails/utils.rb +16 -2
  86. data/lib/react_on_rails/version.rb +1 -1
  87. data/lib/react_on_rails/webpacker_utils.rb +5 -1
  88. data/lib/tasks/assets.rake +17 -6
  89. data/package.json +24 -29
  90. data/rakelib/release.rake +22 -6
  91. data/rakelib/task_helpers.rb +15 -2
  92. data/yarn.lock +2549 -5169
  93. metadata +56 -49
  94. data/.release-it.json +0 -3
  95. data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +0 -10
  96. data/docs/basics/deployment.md +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c3761565aa14795caa2b5c486de9016269ff3d39230c11c0d7bd582a507daa4
4
- data.tar.gz: 21ef8af0d15a75a828852ca179e0b6a9e7ba930036db6ecde58de0e09b5637e5
3
+ metadata.gz: 990d342ddca60683dec307b62b5613bf43979a41d6a17f52e1346f8082cfb439
4
+ data.tar.gz: 7711987e86e65abb363f2951fc618c9cf7d656cf42f6dbc9d6a4bdeaa68e82cf
5
5
  SHA512:
6
- metadata.gz: 3c2c6a6cd0c2e584cfda8bb0ed3be9ad42c5ae14b196d436c3e99813a61df2278ba10940bfaad1968ea868daeb14b844f04ff440bd6424e3ae9bd3cdaf8119ee
7
- data.tar.gz: 0bcfac754d871893719d1604d6e42022c55048e608e6e345d0b9ce5948af3a16a5af8e18d36c4b7232dcd064f931905476981553582203f92d1df4bc189f3be2
6
+ metadata.gz: a1694803ba136e798e0671d4cbaa7319be4740b2d46577e6ce7fc9232e7519f749f8afcb5b19fb1253e13a2f4b4523657ab63c241bc47ae3cce4ccf084049c82
7
+ data.tar.gz: 010a1734f18fe9cb7eceffdf0cf7b902ba3175a994c83885da5c0d2c7fd35afb9f49b0ca20355c6e722e82714afcdfe307d6a853f13f3188428e4dbf293aac2b
data/.circleci/config.yml CHANGED
@@ -31,9 +31,9 @@ aliases:
31
31
  - &install-package-node-modules
32
32
  name: Install Node modules with Yarn for renderer package
33
33
  command: |
34
+ sudo yarn global add yalc
34
35
  yarn install --no-progress --no-emoji
35
36
  yarn run eslint -v
36
- sudo yarn global add yalc
37
37
 
38
38
  # Install/update Node modules for dummy app unless existing set of modules is satisfying Yarn.
39
39
  - &install-dummy-app-node-modules
@@ -69,25 +69,25 @@ aliases:
69
69
  - &restore-package-node-modules-cache
70
70
  name: Restore cached node_modules directory
71
71
  keys:
72
- - v4-package-node-modules-cache-{{ checksum "yarn.lock" }}
72
+ - v5-package-node-modules-cache-{{ checksum "yarn.lock" }}
73
73
 
74
74
  # Restore spec/dummy/node_modules dir from cache using yarn.lock checksum as a key.
75
75
  - &restore-dummy-app-node-modules-cache
76
76
  name: Restore cached spec/dummy/node_modules directory
77
77
  keys:
78
- - v4-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
78
+ - v5-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
79
79
 
80
80
  # Restore vendor/bundle dir from cache using Gemfile.lock checksum as a key.
81
81
  - &restore-dummy-app-gem-cache
82
82
  name: Restore cached Ruby Gems for dummy app
83
83
  keys:
84
- - v4-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
84
+ - v5-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
85
85
 
86
86
  # Restore vendor/bundle dir from cache using react_on_rails.gemspec checksum as a key.
87
87
  - &restore-package-gem-cache
88
88
  name: Restore cached Ruby Gems for package
89
89
  keys:
90
- - v4-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
90
+ - v5-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
91
91
 
92
92
  # NOTE: Sometimes CI generated docker images are not updated in time to keep up with the minimum required
93
93
  # by chromedriver versions of Chrome. Just bump here Chrome version if chromedriver raises errors
@@ -139,7 +139,7 @@ jobs:
139
139
  - run: *install-package-node-modules
140
140
  - save_cache:
141
141
  name: Save root node_modules to cache
142
- key: v4-package-node-modules-cache-{{ checksum "yarn.lock" }}
142
+ key: v5-package-node-modules-cache-{{ checksum "yarn.lock" }}
143
143
  paths:
144
144
  - node_modules
145
145
 
@@ -157,7 +157,7 @@ jobs:
157
157
  - run: *install-dummy-app-node-modules
158
158
  - save_cache:
159
159
  name: Save spec/dummy/node_modules to cache
160
- key: v4-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
160
+ key: v5-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
161
161
  paths:
162
162
  - spec/dummy/node_modules
163
163
  - spec/dummy/node_modules
@@ -172,7 +172,7 @@ jobs:
172
172
  - run: *install-package-ruby-gems
173
173
  - save_cache:
174
174
  name: Save dummy app ruby gems to cache
175
- key: v4-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
175
+ key: v5-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
176
176
  paths:
177
177
  - vendor/bundle
178
178
 
@@ -186,7 +186,7 @@ jobs:
186
186
  - run: *install-dummy-app-ruby-gems
187
187
  - save_cache:
188
188
  name: Save dummy app ruby gems to cache
189
- key: v4-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
189
+ key: v5-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
190
190
  paths:
191
191
  - spec/dummy/vendor/bundle
192
192
 
@@ -209,7 +209,7 @@ jobs:
209
209
  command: cd spec/dummy && yarn run build:test
210
210
  - save_cache:
211
211
  name: Save test webpack bundles to cache (for build number checksum used by rspec job)
212
- key: v4-dummy-app-webpack-bundle-{{ .Revision }}
212
+ key: v5-dummy-app-webpack-bundle-{{ .Revision }}
213
213
  paths:
214
214
  - spec/dummy/public/webpack
215
215
  # Run JS unit tests for Renderer package.
@@ -249,7 +249,7 @@ jobs:
249
249
  - restore_cache: *restore-dummy-app-gem-cache
250
250
  - restore_cache:
251
251
  name: Restore cached webpack bundles for dummy app
252
- key: v4-dummy-app-webpack-bundle-{{ .Revision }}
252
+ key: v5-dummy-app-webpack-bundle-{{ .Revision }}
253
253
  - restore_cache: *restore-dummy-app-node-modules-cache
254
254
  - restore_cache: *restore-package-node-modules-cache
255
255
  - run: *install-package-node-modules
@@ -274,10 +274,22 @@ jobs:
274
274
  # TODO -- need to leverage Circle CI containers
275
275
  command: |
276
276
  bundle exec rake run_rspec:all_dummy
277
+ # The following step will run only if the main job is finished successfully.
278
+ # Build hook is triggered by curl command described here https://docs.netlify.com/configure-builds/build-hooks/
279
+ # NETLIFY_HOOK is an environment variable on CircleCI to keep sensitive data outside the repo
280
+ - run:
281
+ name: Deploy SC website
282
+ command: |
283
+ if [ $CIRCLE_BRANCH = "master" ]; then
284
+ curl -X POST -d '{}' ${NETLIFY_HOOK}
285
+ fi
286
+ when: on_success
277
287
  - store_test_results:
278
288
  path: ~/rspec
279
289
  - store_artifacts:
280
290
  path: spec/dummy/tmp/capybara
291
+ - store_artifacts:
292
+ path: spec/dummy/tmp/screenshots
281
293
  - store_artifacts:
282
294
  path: spec/dummy/log/test.log
283
295
  - store_artifacts:
data/.eslintrc CHANGED
@@ -31,8 +31,10 @@ overrides:
31
31
  - "@typescript-eslint"
32
32
  rules:
33
33
  "@typescript-eslint/no-namespace": 0
34
+ "@typescript-eslint/no-shadow": ["error"]
34
35
 
35
36
  rules:
37
+ no-shadow: 0
36
38
  no-console: 0
37
39
  function-paren-newline: 0
38
40
  object-curly-newline: 0
data/.prettierrc CHANGED
@@ -8,9 +8,6 @@ bracketSpacing: true
8
8
  jsxBracketSameLine: false
9
9
  parser: flow
10
10
 
11
- extends:
12
- - tslint-config-prettier
13
-
14
11
  overrides:
15
12
  - files: "*.@(css|scss)"
16
13
  options:
data/.rubocop.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  # This is the configuration used to check the rubocop source code.
2
2
  # Check out: https://github.com/bbatsov/rubocop
3
- require: rubocop-performance
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
4
6
 
5
7
  AllCops:
6
8
  NewCops: enable
@@ -33,7 +35,8 @@ AllCops:
33
35
 
34
36
  Naming/FileName:
35
37
  Exclude:
36
- - 'Gemfile'
38
+ - '**/Gemfile'
39
+ - '**/Rakefile'
37
40
 
38
41
  Layout/LineLength:
39
42
  Max: 120
@@ -87,6 +90,41 @@ Metrics/ModuleLength:
87
90
  Naming/RescuedExceptionsVariableName:
88
91
  Enabled: false
89
92
 
93
+ RSpec/AnyInstance:
94
+ Exclude:
95
+ - 'spec/react_on_rails/git_utils_spec.rb'
96
+ - 'spec/react_on_rails/locales_to_js_spec.rb'
97
+
98
+ RSpec/DescribeClass:
99
+ Enabled: false
100
+
101
+ RSpec/ExampleLength:
102
+ Enabled: false
103
+
104
+ RSpec/MessageSpies:
105
+ Enabled: false
106
+
107
+ RSpec/NestedGroups:
108
+ Max: 4
109
+
110
+ RSpec/BeforeAfterAll:
111
+ Exclude:
112
+ - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb'
113
+ - 'spec/react_on_rails/generators/install_generator_spec.rb'
114
+
115
+ RSpec/MessageChain:
116
+ Enabled: false
117
+
118
+ RSpec/MultipleExpectations:
119
+ Enabled: false
120
+
121
+ RSpec/MultipleDescribes:
122
+ Exclude:
123
+ - 'spec/dummy/spec/system/integration_spec.rb'
124
+
125
+ RSpec/MultipleMemoizedHelpers:
126
+ Max: 12
127
+
90
128
  Style/GlobalVars:
91
129
  Exclude:
92
130
  - 'spec/dummy/config/environments/development.rb'
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
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
- 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.
4
+ Migration instructions for the major updates can be found [here](https://www.shakacode.com/react-on-rails/docs/guides/upgrading-react-on-rails#upgrading-to-version-9.md). Some smaller migration information can be found here.
5
5
 
6
6
  ## Need Help Migrating?
7
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).
@@ -16,9 +16,36 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
16
16
  Changes since last non-beta release.
17
17
 
18
18
  *Please add entries here for your pull requests that are not yet released.*
19
+
20
+ #### Added
21
+
22
+ - Ability to stop React on Rails from modifying or creating the `assets:precompile` task. [PR 1371](https://github.com/shakacode/react_on_rails/pull/1371) by [justin808](https://github.com/justin808). Thanks to [elstgav](https://github.com/elstgav) for [the suggestion](https://github.com/shakacode/react_on_rails/issues/1368)!
23
+
24
+ - Ability to stop stubbing of setTimeout, setInterval, & clearTimeout conditional by setting `ReactOnRailsPro.config.include_execjs_polyfills = false` in the React on Rails Pro configuration file. Also, added the ability to have render functions return a promise to be awaited by React on Rails Pro Node Renderer. [PR 1380](https://github.com/shakacode/react_on_rails/pull/1380) by [judahmeek](https://github.com/judahmeek)
25
+
26
+ ### [12.3.0] - 2021-07-26
27
+ #### Added
28
+
29
+ - Ability to use with Turbo (@hotwired/turbo), as Turbolinks gets obsolete. [PR 1374](https://github.com/shakacode/react_on_rails/pull/1374) by [pgruener](https://github.com/pgruener) and [PR 1377](https://github.com/shakacode/react_on_rails/pull/1377) by [mdesantis](https://github.com/mdesantis).
30
+
31
+ To configure turbo the following option can be set:
32
+ `ReactOnRails.setOptions({ turbo: true })`
33
+
34
+ ### [12.2.0] - 2021-03-25
35
+ #### Added
36
+ - Ability to configure server react rendering to throw rather than just logging the error. Useful for
37
+ React on Rails Pro Node rendering [PR 1365](https://github.com/shakacode/react_on_rails/pull/1365) by [justin808](https://github.com/justin808).
38
+
39
+ ### [12.1.0] - 2021-03-23
40
+ #### Added
41
+ - Added the ability to assign a module with a `call` method to `config.build_production_command`. See [the configuration docs](https://www.shakacode.com/react-on-rails/docs/guides/configuration). [PR 1362: Accept custom module for config.build_production_command](https://github.com/shakacode/react_on_rails/pull/1362).
42
+
43
+ #### Fixed
44
+ - Stop setting NODE_ENV value during precompile, as it interferred with rails/webpacker's setting of NODE_ENV to production by default. Fixes [#1334](https://github.com/shakacode/react_on_rails/issues/1334). [PR 1356: Don't set NODE_ENV in assets.rake](https://github.com/shakacode/react_on_rails/pull/1356) by [alexrozanski](https://github.com/alexrozanski).
45
+
19
46
  ### [12.0.4] - 2020-11-14
20
47
  #### Fixed
21
- - Install generator now specifies the version. Fixes [React on Rails Generator installs the older npm package #1336](https://github.com/shakacode/react_on_rails/issues/1336). [PR 1338Fix Generator to use Exact NPM Version](https://github.com/shakacode/react_on_rails/pull/1338) by by [justin808](https://github.com/justin808).
48
+ - Install generator now specifies the version. Fixes [React on Rails Generator installs the older npm package #1336](https://github.com/shakacode/react_on_rails/issues/1336). [PR 1338: Fix Generator to use Exact NPM Version](https://github.com/shakacode/react_on_rails/pull/1338) by [justin808](https://github.com/justin808).
22
49
 
23
50
  ### [12.0.3] - 2020-09-20
24
51
  #### Fixed
@@ -30,14 +57,14 @@ Changes since last non-beta release.
30
57
 
31
58
  ### [12.0.2] - 2020-07-09
32
59
  #### Fixed
33
- - Remove dependency upon Redux for Typescript types. [PR 1323](https://github.com/shakacode/react_on_rails/pull/1306) by [justin808](https://github.com/justin808).
60
+ - Remove dependency upon Redux for Typescript types. [PR 1323](https://github.com/shakacode/react_on_rails/pull/1323) by [justin808](https://github.com/justin808).
34
61
 
35
62
  ### [12.0.1] - 2020-07-09
36
63
  #### Fixed
37
64
  - Changed invocation of webpacker:clean to use a very large number of versions so it does not acidentally delete the server-bundle.js. [PR 1306](https://github.com/shakacode/react_on_rails/pull/1306) by By [justin808](https://github.com/justin808).
38
65
 
39
66
  ### [12.0.0] - 2020-07-08
40
- For upgrade instructions, see [docs/basics/upgrading-react-on-rails.md](./docs/basics/upgrading-react-on-rails.md).
67
+ For upgrade instructions, see [docs/guides/upgrading-react-on-rails.md](https://www.shakacode.com/react-on-rails/docs/guides/upgrading-react-on-rails).
41
68
 
42
69
  #### Major Improvements
43
70
  1. **React Hooks Support** for top level components
@@ -53,11 +80,11 @@ set JavaScript property `renderFunction` on the function for which you want to r
53
80
  invoked to return the React component. In that case, you won't need to pass any unused params.
54
81
  [PR 1268](https://github.com/shakacode/react_on_rails/pull/1268) by [justin808](https://github.com/justin808)
55
82
 
56
- See [docs/basics/upgrading-react-on-rails](./docs/basics/upgrading-react-on-rails.md#upgrading-to-v12)
83
+ See [docs/guides/upgrading-react-on-rails](https://www.shakacode.com/react-on-rails/docs/guides/upgrading-react-on-rails#upgrading-to-v12)
57
84
  for details.
58
85
 
59
- #### Other Updates
60
- * `react_on_rails` fully supports `rails/webpacker`. The example test app in `spec/dummy` was recently converted over to use rails/webpacker v4+. It's a good example of how to leverage rails/webpacker's webpack configuration for server-side rendering.
86
+ #### Other Updates
87
+ * `react_on_rails` fully supports `rails/webpacker`. The example test app in `spec/dummy` was recently converted over to use rails/webpacker v4+. It's a good example of how to leverage rails/webpacker's webpack configuration for server-side rendering.
61
88
  * Changed the precompile task to use the rails/webpacker one by default
62
89
  * Updated generators to use React hooks
63
90
  * Requires the use of rails/webpacker view helpers
@@ -72,19 +99,19 @@ for details.
72
99
  * Added configuration option `same_bundle_for_client_and_server` with default `false` because
73
100
 
74
101
  1. Production applications would typically have a server bundle that differs from the client bundle
75
- 2. This change only affects trying to use HMR with react_on_rails with rails/webpacker.
76
-
77
- The previous behavior was to always go to the webpack-dev-server for the server bundle if the
78
- webpack-dev-server was running _and_ the server bundle was found in the `manifest.json`.
79
-
102
+ 2. This change only affects trying to use HMR with react_on_rails with rails/webpacker.
103
+
104
+ The previous behavior was to always go to the webpack-dev-server for the server bundle if the
105
+ webpack-dev-server was running _and_ the server bundle was found in the `manifest.json`.
106
+
80
107
  If you are using the **same bundle for client and server rendering**, then set this configuration option
81
108
  to `true`. By [justin808](https://github.com/shakacode/react_on_rails/pull/1240).
82
-
109
+
83
110
  * Added support to export locales in JSON format. New option added `i18n_output_format` which allows to
84
111
  specify locales format either `JSON` or `JS`. **`JSON` format is now the default.**
85
-
112
+
86
113
  **Use this config setting to get the old behavior: config.i18n_output_format = 'js'**
87
-
114
+
88
115
  [PR 1271](https://github.com/shakacode/react_on_rails/pull/1271) by [ashgaliyev](https://github.com/ashgaliyev).
89
116
 
90
117
  - 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).
@@ -322,7 +349,7 @@ Updated React on Rails to depend on [rails/webpacker](https://github.com/rails/w
322
349
 
323
350
 
324
351
  #### 9.0 from 8.x. Upgrade Instructions
325
- Moved to [our documentation](docs/basics/upgrading-react-on-rails.md#upgrading-to-version-9).
352
+ Moved to [our documentation](https://www.shakacode.com/react-on-rails/docs/guides/upgrading-react-on-rails#upgrading-to-version-9).
326
353
 
327
354
  ### [8.0.7] - 2017-08-16
328
355
  #### Fixed
@@ -672,7 +699,7 @@ Here is the addition to the generated config file:
672
699
  ## [5.2.0] - 2016-04-08
673
700
  ##### Added
674
701
  - Support for React 15.0 to react_on_rails. See [#379](https://github.com/shakacode/react_on_rails/pull/379) by [brucek](https://github.com/brucek).
675
- - Support for Node.js server side rendering. See [#380](https://github.com/shakacode/react_on_rails/pull/380) by [alleycat](https://github.com/alleycat-at-git) and [doc](https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/node-server-rendering.md)
702
+ - Support for Node.js server side rendering. See [#380](https://github.com/shakacode/react_on_rails/pull/380) by [alleycat](https://github.com/alleycat-at-git) and [doc](https://www.shakacode.com/react-on-rails/docs/react-on-rails-pro/react-on-rails-pro#pro-integration-with-nodejs-for-server-rendering)
676
703
 
677
704
  ##### Removed
678
705
  - Generator removals to simplify installer. See [#364](https://github.com/shakacode/react_on_rails/pull/364) by [jbhatab](https://github.com/jbhatab).
@@ -805,11 +832,11 @@ All 5.1.0 changes can be found in [#362](https://github.com/shakacode/react_on_r
805
832
  <%= react_component("ReduxSharedStoreApp", props: {}, prerender: false, trace: true) %>
806
833
  ```
807
834
  You'll get a deprecation message to change this.
808
- - Renamed `ReactOnRails.configure_rspec_to_compile_assets` to `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`. The code has also been optimized to check for whether or not the compiled webpack bundles are up to date or not and will not run if not necessary. If you are using non-standard directories for your generated webpack assets (`app/assets/javascripts/generated` and `app/assets/stylesheets/generated`) or have additional directories you wish the helper to check, you need to update your ReactOnRails configuration accordingly. See [documentation](https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/rspec_configuration.md) for how to do this. [#253](https://github.com/shakacode/react_on_rails/pull/253).
835
+ - Renamed `ReactOnRails.configure_rspec_to_compile_assets` to `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`. The code has also been optimized to check for whether or not the compiled webpack bundles are up to date or not and will not run if not necessary. If you are using non-standard directories for your generated webpack assets (`app/assets/javascripts/generated` and `app/assets/stylesheets/generated`) or have additional directories you wish the helper to check, you need to update your ReactOnRails configuration accordingly. See [documentation](https://www.shakacode.com/react-on-rails/docs/guides/rspec_configuration) for how to do this. [#253](https://github.com/shakacode/react_on_rails/pull/253).
809
836
  - You have to call `ReactOnRails.register` to register react components. This was deprecated in v2. [#273](https://github.com/shakacode/react_on_rails/pull/273).
810
837
 
811
838
  ##### Migration Steps v2 to v3
812
- - [spec/dummy/spec/rails_helper.rb](https://github.com/shakacode/react_on_rails/blob/master/spec%2Fdummy%2Fspec%2Frails_helper.rb#L36..38) for an example. Add this line to your `rails_helper.rb`:
839
+ - See [these changes of spec/dummy/spec/rails_helper.rb](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/spec/rails_helper.rb#L36..38) for an example. Add this line to your `rails_helper.rb`:
813
840
  ```ruby
814
841
  RSpec.configure do |config|
815
842
  # Ensure that if we are running js tests, we are using latest webpack assets
@@ -825,7 +852,7 @@ RSpec.configure do |config|
825
852
 
826
853
  ## [2.2.0] - 2016-01-29
827
854
  ##### Added
828
- - New JavaScript API for debugging TurboLinks issues. Be sure to see [turbolinks docs](docs/additional-reading/turbolinks.md). `ReactOnRails.setOptions({ traceTurbolinks: true });`. Removed the file `debug_turbolinks` added in 2.1.1. See [#243](https://github.com/shakacode/react_on_rails/pull/243).
855
+ - New JavaScript API for debugging TurboLinks issues. Be sure to see [turbolinks docs](https://www.shakacode.com/react-on-rails/docs/rails/turbolinks). `ReactOnRails.setOptions({ traceTurbolinks: true });`. Removed the file `debug_turbolinks` added in 2.1.1. See [#243](https://github.com/shakacode/react_on_rails/pull/243).
829
856
 
830
857
  ## [2.1.1] - 2016-01-28
831
858
 
@@ -834,21 +861,21 @@ RSpec.configure do |config|
834
861
 
835
862
  ##### Added
836
863
  - `ReactOnRails.render` returns a virtualDomElement Reference to your React component's backing instance. See [#234](https://github.com/shakacode/react_on_rails/pull/234).
837
- - `debug_turbolinks` helper for debugging turbolinks issues. See [turbolinks](docs/additional-reading/turbolinks.md).
864
+ - `debug_turbolinks` helper for debugging turbolinks issues. See [turbolinks](https://www.shakacode.com/react-on-rails/docs/rails/turbolinks).
838
865
  - Enhanced regression testing for non-turbolinks apps. Runs all tests for dummy app with turbolinks both disabled and enabled.
839
866
 
840
867
  ## [2.1.0] - 2016-01-26
841
868
  ##### Added
842
- - Added EnsureAssetsCompiled feature so that you do not accidentally run tests without properly compiling the JavaScript bundles. Add a line to your `rails_helper.rb` file to check that the latest Webpack bundles have been generated prior to running tests that may depend on your client-side code. See [docs](docs/additional-reading/rspec_configuration.md) for more detailed instructions. [#222](https://github.com/shakacode/react_on_rails/pull/222)
843
- - Added [migration guide](https://github.com/shakacode/react_on_rails#migrate-from-react-rails) for migrating from React-Rails. [#219](https://github.com/shakacode/react_on_rails/pull/219)
844
- - Added [React on Rails Doctrine](docs/doctrine.md) to docs. Discusses the project's motivations, conventions, and principles. [#220](https://github.com/shakacode/react_on_rails/pull/220)
869
+ - Added EnsureAssetsCompiled feature so that you do not accidentally run tests without properly compiling the JavaScript bundles. Add a line to your `rails_helper.rb` file to check that the latest Webpack bundles have been generated prior to running tests that may depend on your client-side code. See [docs](https://www.shakacode.com/react-on-rails/docs/guides/rspec_configuration) for more detailed instructions. [#222](https://github.com/shakacode/react_on_rails/pull/222)
870
+ - Added [migration guide](https://www.shakacode.com/react-on-rails/docs/additional-details/migrating-from-react-rails) for migrating from React-Rails. [#219](https://github.com/shakacode/react_on_rails/pull/219)
871
+ - Added [React on Rails Doctrine](https://www.shakacode.com/react-on-rails/docs/misc/doctrine) to docs. Discusses the project's motivations, conventions, and principles. [#220](https://github.com/shakacode/react_on_rails/pull/220)
845
872
  - Added ability to skip `display:none` style in the generated content tag for a component. Some developers may want to disable inline styles for security reasons. See generated config [initializer file](lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb#L27) for example on setting `skip_display_none`. [#218](https://github.com/shakacode/react_on_rails/pull/218)
846
873
 
847
874
  ##### Changed
848
875
  - Changed message when running the dev (a.k.a. "express" server). [#227](https://github.com/shakacode/react_on_rails/commit/543ae70254d0c7b477e2c92af86f40746e58a431)
849
876
 
850
877
  ##### Fixed
851
- - Fixed handling of Turbolinks. Code was checking that Turbolinks was installed when it was not yet because some setups load Turbolinks after the bundles. The changes to the code will check if Turbolinks is installed after the page loaded event fires. Code was also added to allow easy debugging of Turbolinks, which should be useful when v5 of Turbolinks is released shortly. Details of how to configure Turbolinks with troubleshooting were added to docs/additional-reading/turbolinks.md. [#221](https://github.com/shakacode/react_on_rails/pull/221)
878
+ - Fixed handling of Turbolinks. Code was checking that Turbolinks was installed when it was not yet because some setups load Turbolinks after the bundles. The changes to the code will check if Turbolinks is installed after the page loaded event fires. Code was also added to allow easy debugging of Turbolinks, which should be useful when v5 of Turbolinks is released shortly. Details of how to configure Turbolinks with troubleshooting were added to `docs` directory. [#221](https://github.com/shakacode/react_on_rails/pull/221)
852
879
  - Fixed issue with already initialized constant warning appearing when starting a Rails server [#226](https://github.com/shakacode/react_on_rails/pull/226)
853
880
  - Fixed to make backwards compatible with Ruby v2.0 and updated all Ruby and Node dependencies.
854
881
 
@@ -946,7 +973,10 @@ Best done with Object destructing:
946
973
  ##### Fixed
947
974
  - Fix several generator related issues.
948
975
 
949
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.0.4...master
976
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.3.0...master
977
+ [12.3.0]: https://github.com/shakacode/react_on_rails/compare/12.2.0...12.3.0
978
+ [12.2.0]: https://github.com/shakacode/react_on_rails/compare/12.1.0...12.2.0
979
+ [12.1.0]: https://github.com/shakacode/react_on_rails/compare/12.0.4...12.1.0
950
980
  [12.0.4]: https://github.com/shakacode/react_on_rails/compare/12.0.3...12.0.4
951
981
  [12.0.3]: https://github.com/shakacode/react_on_rails/compare/12.0.2...12.0.3
952
982
  [12.0.2]: https://github.com/shakacode/react_on_rails/compare/12.0.1...12.0.2
data/CONTRIBUTING.md CHANGED
@@ -5,6 +5,7 @@
5
5
  * See other docs in [docs/contributor-info](./docs/contributor-info)
6
6
 
7
7
  ## To run tests:
8
+ * [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
8
9
  * After updating code via git, to prepare all examples and run all tests:
9
10
 
10
11
  ```sh
@@ -64,7 +65,7 @@ yarn
64
65
  # Update the lib directory with babel compiled files
65
66
  yarn run build-watch
66
67
  ```
67
-
68
+
68
69
  You need to do this once:
69
70
 
70
71
  ```
@@ -192,7 +193,7 @@ Then run `bundle`.
192
193
 
193
194
  The main installer can be run with ```rails generate react_on_rails:install```
194
195
 
195
- Then use yalc to add the npm module.
196
+ Then use yalc to add the npm module.
196
197
 
197
198
  Be sure that your ran this first at the top level of React on Rails
198
199
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  gem "webpacker"
4
- gem "bootsnap", ">= 1.1.0", require: false
4
+ gem "bootsnap", require: false
5
5
  gem "rails"
6
6
  gem "sqlite3"
7
7
  gem "sass-rails"
@@ -29,8 +29,9 @@ group :development, :test do
29
29
  gem "pry-doc"
30
30
  gem "pry-rails"
31
31
  gem "pry-rescue"
32
- gem "rubocop", require: false
32
+ gem "rubocop", "1.14.0", require: false
33
33
  gem "rubocop-performance", require: false
34
+ gem "rubocop-rspec", require: false
34
35
  gem "scss_lint", require: false
35
36
  gem "spring"
36
37
  end
@@ -46,5 +47,5 @@ group :test do
46
47
  gem "rspec-rails"
47
48
  gem "rspec-retry"
48
49
  gem "selenium-webdriver"
49
- gem "webdrivers", "~> 3.0"
50
+ gem "webdrivers", "3.9.4"
50
51
  end
data/NEWS.md CHANGED
@@ -1,21 +1,27 @@
1
1
  # NEWS
2
2
 
3
- *We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
3
+ *A history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
4
4
 
5
+ * **October 14, 2020**: [RUBY ROGUES
6
+ RR 474: React on Rails V12 – Don’t Shave That Yak! with Justin Gordon](https://devchat.tv/ruby-rogues/rr-474-react-on-rails-v12-dont-shave-that-yak-with-justin-gordon/).
7
+
8
+ * **October 1, 2020**: See the [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) example repo for a simple configuration of webpack via the rails/webpacker gem
9
+ that supports SSR.
10
+ * **August 2, 2020**: See the example repo of [React on Rails Tutorial With SSR, HMR fast refresh, and TypeScript](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh) for a new way to setup the creation of your SSR bundle with `rails/webpacker`.
5
11
  * July 8, 2020: Release **v12**.
6
12
  1. **React Hooks Support** for top level components
7
13
  2. **Typescript bindings**
8
14
  3. **rails/webpacker** "just works" with React on Rails by default.
9
15
  4. i18n support for generating a JSON file rather than a JS file.
10
16
  * 2018-02-27: **Version 10.1.2** Supports the React API for ReactDOM.hydrate.
11
- * 2017-09-06: **VERSION 9.0.0 shipped!** This version depends on Webpacker directly. See [Upgrading React on Rails](./docs/basics/upgrading-react-on-rails.md) for more concise instructions on upgrading.
17
+ * 2017-09-06: **VERSION 9.0.0 shipped!** This version depends on Webpacker directly. See [Upgrading React on Rails](./docs/guides/upgrading-react-on-rails.md) for more concise instructions on upgrading.
12
18
  * Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes.
13
19
  * [VERSION 8.1.0](https://rubygems.org/gems/react_on_rails/) shipped with [webpacker_lite](https://github.com/shakacode/webpacker_lite) (soon [**webpacker**](https://github.com/rails/webpacker/issues/464#issuecomment-310986140) support! [react-webpack-rails-tutorial PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395) shows the changes needed to migrate from the Asset Pipeline to Webpacker Lite. For more information, see my article: [Webpacker Lite: Why Fork Webpacker?](https://blog.shakacode.com/webpacker-lite-why-fork-webpacker-f0a7707fac92). Per recent discussions, we [will merge Webpacker Lite changes back into Webpacker](https://github.com/rails/webpacker/issues/464#issuecomment-310986140). There's no reason to wait for this. The upgrade will eventually be trivial.
14
20
  * 2017-04-25: 7.0.0 Shipped! Performance improvements! Please upgrade! Only "breaking" change is that you have to update both the node module and the Ruby gem.
15
21
  * 2017-04-09: 8.0.0 beta work to include webpacker_lite gem has begun. See [#786](https://github.com/shakacode/react_on_rails/issues/786).
16
22
  * 2017-04-03: 6.9.3 Released! Props rendered in JSON script tag. Page size is smaller now due to less escaping!
17
23
  * 2017-03-06: Updated to Webpack v2!
18
- * 2017-03-02: Demo of internationalization (i18n) is live at [reactrails.com](https://www.reactrails.com/). Docs [here](docs/basics/i18n.md).
24
+ * 2017-03-02: Demo of internationalization (i18n) is live at [reactrails.com](https://www.reactrails.com/). Docs [here](docs/guides/i18n.md).
19
25
  * 2017-02-28: See [discussions here on Webpacker](https://github.com/rails/webpacker/issues/139) regarding how Webpacker will allow React on Rails to avoid using the asset pipeline in the near future.
20
26
  * 2017-02-28: Upgrade to Webpack v2 or use the `--bail` option in your webpack script for test and production builds. See the discussion on [PR #730](https://github.com/shakacode/react_on_rails/pull/730).
21
27
  * 2016-11-03: Spoke at [LA Ruby: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp).
@@ -54,4 +60,3 @@
54
60
  * React on Rails does not yet have *generator* support for building new apps that use CSS modules and hot reloading via the Rails server as is demonstrated in the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). *We do support this, but we don't generate the code.* If you did generate a fresh app from react_on_rails and want to move to CSS Modules, then see [PR 175: Babel 6 / CSS Modules / Rails hot reloading](https://github.com/shakacode/react-webpack-rails-tutorial/pull/175). Note, while there are probably fixes after this PR was accepted, this has the majority of the changes. See [the tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/#news) for more information. Ping us if you want to help!
55
61
  * [ShakaCode](http://www.shakacode.com) is doing Skype plus Slack/Github based coaching for "React on Rails". [Click here](http://www.shakacode.com/work/index.html) for more information.
56
62
  * Be sure to read our article [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724).
57
-