react_on_rails 13.3.5 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +100 -62
  3. data/Gemfile.development_dependencies +10 -9
  4. data/README.md +7 -2
  5. data/lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb +41 -0
  6. data/lib/generators/react_on_rails/base_generator.rb +13 -49
  7. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
  8. data/lib/generators/react_on_rails/generator_messages.rb +40 -0
  9. data/lib/generators/react_on_rails/install_generator.rb +21 -0
  10. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +2 -2
  11. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static +2 -2
  12. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +2 -2
  13. data/lib/generators/react_on_rails/templates/base/base/config/{webpacker.yml → shakapacker.yml} +3 -3
  14. data/lib/generators/react_on_rails/templates/base/base/config/webpack/commonWebpackConfig.js.tt +3 -1
  15. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +2 -2
  16. data/lib/generators/react_on_rails/templates/dev_tests/spec/system/hello_world_spec.rb +1 -1
  17. data/lib/react_on_rails/configuration.rb +39 -25
  18. data/lib/react_on_rails/git_utils.rb +3 -3
  19. data/lib/react_on_rails/helper.rb +25 -13
  20. data/lib/react_on_rails/json_output.rb +0 -17
  21. data/lib/react_on_rails/locales/base.rb +4 -4
  22. data/lib/react_on_rails/locales/to_js.rb +1 -1
  23. data/lib/react_on_rails/packs_generator.rb +4 -4
  24. data/lib/react_on_rails/react_component/render_options.rb +1 -1
  25. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +10 -12
  26. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +3 -3
  27. data/lib/react_on_rails/test_helper.rb +2 -2
  28. data/lib/react_on_rails/utils.rb +2 -8
  29. data/lib/react_on_rails/version.rb +1 -1
  30. data/lib/react_on_rails/version_checker.rb +2 -2
  31. data/lib/react_on_rails/webpacker_utils.rb +6 -0
  32. data/lib/tasks/assets.rake +1 -1
  33. data/react_on_rails.gemspec +4 -4
  34. metadata +6 -131
  35. data/.bookignore +0 -15
  36. data/.circleci/config.yml +0 -338
  37. data/.coveralls.yml +0 -1
  38. data/.dockerignore +0 -2
  39. data/.eslintignore +0 -17
  40. data/.eslintrc +0 -53
  41. data/.github/FUNDING.yml +0 -1
  42. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
  43. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  44. data/.github/PULL_REQUEST_TEMPLATE.md +0 -19
  45. data/.github/workflows/lint-js-and-ruby.yml +0 -54
  46. data/.github/workflows/main.yml +0 -183
  47. data/.github/workflows/package-js-tests.yml +0 -35
  48. data/.github/workflows/rspec-package-specs.yml +0 -46
  49. data/.gitignore +0 -33
  50. data/.npmignore +0 -22
  51. data/.prettierignore +0 -14
  52. data/.prettierrc +0 -20
  53. data/.rspec +0 -2
  54. data/.rubocop.yml +0 -134
  55. data/.scss-lint.yml +0 -205
  56. data/.travis.yml +0 -61
  57. data/book.json +0 -18
  58. data/docs/additional-details/generator-details.md +0 -56
  59. data/docs/additional-details/manual-installation-overview.md +0 -30
  60. data/docs/additional-details/migrating-from-react-rails.md +0 -17
  61. data/docs/additional-details/recommended-project-structure.md +0 -69
  62. data/docs/additional-details/updating-dependencies.md +0 -31
  63. data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +0 -10
  64. data/docs/api/javascript-api.md +0 -99
  65. data/docs/api/redux-store-api.md +0 -102
  66. data/docs/api/view-helpers-api.md +0 -133
  67. data/docs/contributor-info/errors-with-hooks.md +0 -45
  68. data/docs/contributor-info/generator-testing.md +0 -11
  69. data/docs/contributor-info/linters.md +0 -68
  70. data/docs/contributor-info/pull-requests.md +0 -42
  71. data/docs/contributor-info/releasing.md +0 -76
  72. data/docs/deployment/elastic-beanstalk.md +0 -63
  73. data/docs/deployment/heroku-deployment.md +0 -35
  74. data/docs/getting-started.md +0 -195
  75. data/docs/guides/client-vs-server-rendering.md +0 -27
  76. data/docs/guides/configuration.md +0 -289
  77. data/docs/guides/deployment.md +0 -5
  78. data/docs/guides/file-system-based-automated-bundle-generation.md +0 -205
  79. data/docs/guides/hmr-and-hot-reloading-with-the-webpack-dev-server.md +0 -104
  80. data/docs/guides/how-react-on-rails-works.md +0 -44
  81. data/docs/guides/how-to-conditionally-server-render-based-on-device-type.md +0 -40
  82. data/docs/guides/how-to-use-different-files-for-client-and-server-rendering.md +0 -98
  83. data/docs/guides/i18n.md +0 -87
  84. data/docs/guides/installation-into-an-existing-rails-app.md +0 -66
  85. data/docs/guides/minitest-configuration.md +0 -31
  86. data/docs/guides/rails-webpacker-react-integration-options.md +0 -213
  87. data/docs/guides/react-on-rails-overview.md +0 -30
  88. data/docs/guides/react-server-rendering.md +0 -32
  89. data/docs/guides/render-functions-and-railscontext.md +0 -205
  90. data/docs/guides/rspec-configuration.md +0 -73
  91. data/docs/guides/tutorial.md +0 -374
  92. data/docs/guides/upgrading-react-on-rails.md +0 -304
  93. data/docs/guides/webpack-configuration.md +0 -42
  94. data/docs/home.md +0 -23
  95. data/docs/javascript/angular-js-integration-migration.md +0 -28
  96. data/docs/javascript/asset-pipeline.md +0 -12
  97. data/docs/javascript/capistrano-deployment.md +0 -18
  98. data/docs/javascript/code-splitting.md +0 -165
  99. data/docs/javascript/converting-from-custom-webpack-config-to-rails-webpacker-config.md +0 -10
  100. data/docs/javascript/credits.md +0 -10
  101. data/docs/javascript/foreman-issues.md +0 -15
  102. data/docs/javascript/images.md +0 -57
  103. data/docs/javascript/node-dependencies-and-npm.md +0 -19
  104. data/docs/javascript/react-and-redux.md +0 -36
  105. data/docs/javascript/react-helmet.md +0 -100
  106. data/docs/javascript/react-router.md +0 -90
  107. data/docs/javascript/server-rendering-tips.md +0 -55
  108. data/docs/javascript/troubleshooting-when-using-webpacker.md +0 -90
  109. data/docs/javascript/webpack-v1-notes.md +0 -23
  110. data/docs/javascript/webpack.md +0 -22
  111. data/docs/misc/articles.md +0 -20
  112. data/docs/misc/code_of_conduct.md +0 -13
  113. data/docs/misc/doctrine.md +0 -77
  114. data/docs/misc/style.md +0 -33
  115. data/docs/misc/tips.md +0 -10
  116. data/docs/outdated/deferred-rendering.md +0 -39
  117. data/docs/outdated/rails-assets-relative-paths.md +0 -195
  118. data/docs/outdated/rails-assets.md +0 -77
  119. data/docs/outdated/rails3.md +0 -9
  120. data/docs/rails/convert-rails-5-api-only-app.md +0 -19
  121. data/docs/rails/rails-engine-integration.md +0 -32
  122. data/docs/rails/rails_view_rendering_from_inline_javascript.md +0 -36
  123. data/docs/rails/turbolinks.md +0 -124
  124. data/docs/react-on-rails-pro/react-on-rails-pro.md +0 -43
  125. data/docs/testimonials/hvmn.md +0 -25
  126. data/docs/testimonials/resortpass.md +0 -13
  127. data/docs/testimonials/testimonials.md +0 -28
  128. data/jest.config.js +0 -4
  129. data/package-scripts.yml +0 -49
  130. data/package.json +0 -96
  131. data/rakelib/docker.rake +0 -26
  132. data/rakelib/dummy_apps.rake +0 -30
  133. data/rakelib/example_type.rb +0 -96
  134. data/rakelib/examples.rake +0 -64
  135. data/rakelib/examples_config.yml +0 -14
  136. data/rakelib/lint.rake +0 -30
  137. data/rakelib/node_package.rake +0 -15
  138. data/rakelib/release.rake +0 -92
  139. data/rakelib/run_rspec.rake +0 -103
  140. data/rakelib/task_helpers.rb +0 -62
  141. data/script/bootstrap +0 -33
  142. data/script/release +0 -3
  143. data/script/setup +0 -23
  144. data/script/test +0 -38
  145. data/webpackConfigLoader.js +0 -71
  146. data/yarn.lock +0 -7010
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4483ea8d99927209e3115c17b967b22a187637111724b7928d3c7a4ff8672981
4
- data.tar.gz: 121595ddc9e1d581ff289e4796bdd660b2107e504a30a1fdc5594daa7f2f411c
3
+ metadata.gz: 37cf3a6fba0b83dec923947d8cc8f883f3f4f8ff06c51760347bbe41a79ee35a
4
+ data.tar.gz: 522f25ca29ebd985f975d9f8dd7ab8947ef4ccacc7591f28db176b0c2964f444
5
5
  SHA512:
6
- metadata.gz: 9c584cc7cad86fbac89377fd062dbe69686b51cdd078659cce234b77ae549d1c8071770458ebb5c0be6b5922716c6083ef2cbb731e96241d259de2f21e2d6ed4
7
- data.tar.gz: a2eac20d40c6e06ccb191ea210d5bf1c024486611e05fed2f4b1260f4d04ea8b740b455770a6dfbf24d5497d3b723674e43e8e3ce366e08dc193c7e4d2587dfa
6
+ metadata.gz: 873fc4c65b407b3982ef2761d0e5e346ef8eb04dc9468b074db188f641537634578b057b59a3b4b12135a988bd725207ded6a20e9b4a97ca42f39c31ea934928
7
+ data.tar.gz: 6f46192a308e4d636bbe954e3c34bc256aab07c9b42bf177c9254fde495e37726a46b285df1124ef2ebc859b2311cf77afca8bb16158f39a5eb9fec013d714b2
data/CHANGELOG.md CHANGED
@@ -1,67 +1,102 @@
1
1
  # Change Log
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.
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 the next version.
3
3
 
4
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
- ## Need Help Migrating?
6
+ ## Want to Save Time Updating?
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).
8
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.
9
+ We specialize in helping companies quickly and efficiently update client-side dependencies, allowing developers to focus on features and bug fixes rather than addressing tech-debt from old dependencies. ShakaCode also maintains Shakapacker, the successor to Webpacker.
10
10
 
11
11
  ## Contributors
12
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.
13
13
 
14
14
  ## Versions
15
15
  ### [Unreleased]
16
- Changes since last non-beta release.
16
+ Changes since the last non-beta release.
17
17
 
18
- *Please add entries here for your pull requests that are not yet released.*
18
+ ### [14.0.0] - 2024-04-03
19
+ _Major bump because dropping support for Ruby 2.7 and deprecated `webpackConfigLoader.js`._
19
20
 
20
- ### [13.3.5] - 2022-05-31
21
+ #### Removed
22
+ - Dropped Ruby 2.7 support [PR 1595](https://github.com/shakacode/react_on_rails/pull/1595) by [ahangarha](https://github.com/ahangarha).
23
+ - Removed deprecated `webpackConfigLoader.js` [PR 1600](https://github.com/shakacode/react_on_rails/pull/1600) by [ahangarha](https://github.com/ahangarha).
24
+
25
+ #### Fixed
26
+ - Trimmed the Gem to remove package.json which could cause superflous security warnings. [PR 1605](https://github.com/shakacode/react_on_rails/pull/1605) by [justin808](https://github.com/justin808).
27
+ - Prevent displaying the deprecation message for using `webpacker_precompile?` method and `webpacker:clean` rake task when using Shakapacker v7+ [PR 1592](https://github.com/shakacode/react_on_rails/pull/1592) by [ahangarha](https://github.com/ahangarha).
28
+
29
+ ### [13.4.1]
30
+ #### Fixed
31
+ - Fixed Typescript types for ServerRenderResult, ReactComponent, RenderFunction, and RailsContext interfaces. [PR 1582](https://github.com/shakacode/react_on_rails/pull/1582) & [PR 1585](https://github.com/shakacode/react_on_rails/pull/1585) by [kotarella1110](https://github.com/kotarella1110)
32
+
33
+ - Removed a workaround in `JsonOutput#escape` for an no-longer supported Rails version. Additionally, removed `Utils.rails_version_less_than_4_1_1`
34
+ which was only used in the workaround. [PR 1580](https://github.com/shakacode/react_on_rails/pull/1580) by [wwahammy](https://github.com/wwahammy)
35
+
36
+ #### Added
37
+ - Exposed TypeScript all types [PR 1586](https://github.com/shakacode/react_on_rails/pull/1586) by [kotarella1110](https://github.com/kotarella1110)
38
+
39
+ ### [13.4.0] - 2023-07-30
40
+ #### Fixed
41
+ - Fixed Pack Generation logic during `assets:precompile` if `auto_load_bundle` is `false` & `components_subdirectory` is not set. [PR 1567](https://github.com/shakacode/react_on_rails/pull/1545) by [blackjack26](https://github.com/blackjack26) & [judahmeek](https://github.com/judahmeek).
42
+
43
+ #### Improved
44
+ - Improved performance by removing an unnecessary JS eval from Ruby. [PR 1544](https://github.com/shakacode/react_on_rails/pull/1544) by [wyattades](https://github.com/wyattades).
45
+
46
+ #### Added
47
+ - Added support for Shakapacker 7 in install generator [PR 1548](https://github.com/shakacode/react_on_rails/pull/1548) by [ahangarha](https://github.com/ahangarha).
48
+
49
+ #### Changed
50
+ - Throw error when attempting to redefine ReactOnRails. [PR 1562](https://github.com/shakacode/react_on_rails/pull/1562) by [rubenochiavone](https://github.com/rubenochiavone).
51
+ - Prevent generating FS-based packs when `component_subdirectory` configuration is not present. [PR 1567](https://github.com/shakacode/react_on_rails/pull/1567) by [blackjack26](https://github.com/blackjack26).
52
+ - Removed a requirement for autoloaded pack files to be generated as part of CI or deployment separate from initial Shakapacker bundling. [PR 1545](https://github.com/shakacode/react_on_rails/pull/1545) by [judahmeek](https://github.com/judahmeek).
53
+
54
+
55
+ ### [13.3.5] - 2023-05-31
21
56
  #### Fixed
22
57
  - Fixed race condition where a react component could attempt to initialize before it had been registered. [PR 1540](https://github.com/shakacode/react_on_rails/pull/1540) by [judahmeek](https://github.com/judahmeek).
23
58
 
24
- ### [13.3.4] - 2022-05-23
59
+ ### [13.3.4] - 2023-05-23
25
60
 
26
- ### Added
61
+ #### Added
27
62
  - Improved functionality of Filesystem-based pack generation & auto-bundling. Added `make_generated_server_bundle_the_entrypoint` configuration key. [PR 1531](https://github.com/shakacode/react_on_rails/pull/1531) by [judahmeek](https://github.com/judahmeek).
28
63
 
29
- ### Removed
64
+ #### Removed
30
65
  - Removed unneeded `HMR=true` from `Procfile.dev` in install template [PR 1537](https://github.com/shakacode/react_on_rails/pull/1537) by [ahangarha](https://github.com/ahangarha).
31
66
 
32
- ### [13.3.3] - 2022-03-21
67
+ ### [13.3.3] - 2023-03-21
33
68
 
34
- ### Fixed
69
+ #### Fixed
35
70
  - Fixed bug regarding loading FS-based packs. [PR 1527](https://github.com/shakacode/react_on_rails/pull/1527) by [judahmeek](https://github.com/judahmeek).
36
71
 
37
- ### [13.3.2] - 2022-02-24
72
+ ### [13.3.2] - 2023-02-24
38
73
 
39
- ### Fixed
74
+ #### Fixed
40
75
  - Fixed the bug in `bin/dev` and `bin/dev-static` scripts by using `system` instead of `exec` and remove option to pass arguments [PR 1519](https://github.com/shakacode/react_on_rails/pull/1519) by [ahangarha](https://github.com/ahangarha).
41
76
 
42
- ### [13.3.1] - 2022-01-30
43
- ## Added
77
+ ### [13.3.1] - 2023-01-30
78
+ #### Added
44
79
  - Optimized `ReactOnRails::TestHelper`'s RSpec integration using `when_first_matching_example_defined`. [PR 1496](https://github.com/shakacode/react_on_rails/pull/1496) by [mcls](https://github.com/mcls).
45
80
 
46
- ### Fixed
81
+ #### Fixed
47
82
  - Fixed bug regarding FS-based packs generation. [PR 1515](https://github.com/shakacode/react_on_rails/pull/1515) by [pulkitkkr](https://github.com/pulkitkkr).
48
83
 
49
- ### [13.3.0] - 2022-01-29
50
- ### Fixed
84
+ ### [13.3.0] - 2023-01-29
85
+ #### Fixed
51
86
  - Fixed pack not found warning while using `react_component` and `react_component_hash` helpers, even when corresponding chunks are present. [PR 1511](https://github.com/shakacode/react_on_rails/pull/1511) by [pulkitkkr](https://github.com/pulkitkkr).
52
87
  - Fixed FS-based packs generation functionality to trigger pack generation on the creation of a new react component inside `components_subdirectory`. [PR 1506](https://github.com/shakacode/react_on_rails/pull/1506) by [pulkitkkr](https://github.com/pulkitkkr).
53
88
  - Upgrade several JS dependencies to fix security issues. [PR 1514](https://github.com/shakacode/react_on_rails/pull/1514) by [ahangarha](https://github.com/ahangarha).
54
89
 
55
- ### Added
90
+ #### Added
56
91
  - Added `./bin/dev` and `./bin/dev-static` executables to ease and standardize running the dev server. [PR 1491](https://github.com/shakacode/react_on_rails/pull/1491) by [ahangarha](https://github.com/ahangarha).
57
92
 
58
93
  ### [13.2.0] - 2022-12-23
59
94
 
60
- ### Fixed
95
+ #### Fixed
61
96
  - Fix reactOnRailsPageUnloaded when there is no component on the page. Important for apps using both hotwire and react_on_rails. [PR 1498](https://github.com/shakacode/react_on_rails/pull/1498) by [NhanHo](https://github.com/NhanHo).
62
97
  - Fixing wrong type. The throwIfMissing param of getStore should be optional as it defaults to true. [PR 1480](https://github.com/shakacode/react_on_rails/pull/1480) by [wouldntsavezion](https://github.com/wouldntsavezion).
63
98
 
64
- ### Added
99
+ #### Added
65
100
  - Exposed `reactHydrateOrRender` utility via [PR 1481](https://github.com/shakacode/react_on_rails/pull/1481) by [vaukalak](https://github.com/vaukalak).
66
101
 
67
102
  ### [13.1.0] - 2022-08-20
@@ -109,16 +144,16 @@ Changes since last non-beta release.
109
144
 
110
145
  ### [12.6.0] - 2022-01-22
111
146
 
112
- ### Added
147
+ #### Added
113
148
  - A `rendering_props_extension` configuration which takes a module with an `adjust_props_for_client_side_hydration` method, which is used to process props differently for server/client if `prerender` is set to `true`. [PR 1413](https://github.com/shakacode/react_on_rails/pull/1413) by [gscarv13](https://github.com/gscarv13) & [judahmeek](https://github.com/judahmeek).
114
149
 
115
150
  ### [12.5.2] - 2021-12-29
116
- ### Fixed
151
+ #### Fixed
117
152
  - Usage of config.build_production_command for custom command for production builds fixed. [PR 1415](https://github.com/shakacode/react_on_rails/pull/1415) by [judahmeek](https://github.com/judahmeek).
118
153
 
119
154
  ### [12.5.1] - 2021-12-27
120
155
 
121
- ### Fixed
156
+ #### Fixed
122
157
  - A fatal server rendering error if running an ReactOnRails >=12.4.0 with ReactOnRails Pro <2.4.0. [PR 1412](https://github.com/shakacode/react_on_rails/pull/1412) by [judahmeek](https://github.com/judahmeek).
123
158
 
124
159
  ### [12.5.0] - 2021-12-26
@@ -478,7 +513,7 @@ Moved to [our documentation](https://www.shakacode.com/react-on-rails/docs/guide
478
513
  - Fixes GitUtils.uncommitted_changes? throwing an error when called in an environment without Git, and allows install generator to be run successfully with `--ignore-warnings` [#878](https://github.com/shakacode/react_on_rails/pull/878) by [jasonblalock](https://github.com/jasonblalock).
479
514
 
480
515
  ## [8.0.5] - 2017-07-04
481
- ### fixed
516
+ #### Fixed
482
517
  - Corrects `devBuild` value for webpack production build from webpackConfigLoader. [#877](https://github.com/shakacode/react_on_rails/pull/877) by [chenqingspring](https://github.com/chenqingspring).
483
518
  - Remove contentBase deprecation warning message. [#878](https://github.com/shakacode/react_on_rails/pull/878) by [ened ](https://github.com/ened).
484
519
  - Removes invalid reference to _railsContext in the generated files. [#886](https://github.com/shakacode/react_on_rails/pull/886) by [justin808](https://github.com/justin808).
@@ -487,11 +522,11 @@ Moved to [our documentation](https://www.shakacode.com/react-on-rails/docs/guide
487
522
  *Note: 8.0.4 skipped.*
488
523
 
489
524
  ## [8.0.3] - 2017-06-19
490
- ### Fixed
525
+ #### Fixed
491
526
  - Ruby 2.1 issue due to `<<~` as reported in [issue #870](https://github.com/shakacode/react_on_rails/issues/870). [#867](https://github.com/shakacode/react_on_rails/pull/867) by [justin808](https://github.com/justin808)
492
527
 
493
528
  ## [8.0.2] - 2017-06-04
494
- ### Fixed
529
+ #### Fixed
495
530
  - Any failure in webpack to build test files quits tests.
496
531
  - Fixed a Ruby 2.4 potential crash which could cause a crash due to pathname change in Ruby 2.4.
497
532
  - CI Improvements:
@@ -502,7 +537,7 @@ Moved to [our documentation](https://www.shakacode.com/react-on-rails/docs/guide
502
537
  - [#862](https://github.com/shakacode/react_on_rails/pull/862) by [justin808](https://github.com/justin808)
503
538
 
504
539
  ## [8.0.1] - 2017-05-30
505
- ### Fixed
540
+ #### Fixed
506
541
  - Generator no longer modifies `assets.rb`. [#859](https://github.com/shakacode/react_on_rails/pull/859) by [justin808](https://github.com/justin808)
507
542
 
508
543
  ## [8.0.0] - 2017-05-29
@@ -515,21 +550,21 @@ Moved to [our documentation](https://www.shakacode.com/react-on-rails/docs/guide
515
550
  - For a simple example of the webpacker_lite setup, run the basic generator.
516
551
 
517
552
  ## [8.0.0-beta.3] - 2017-05-27
518
- ### Changed
553
+ #### Changed
519
554
  - Major updates for WebpackerLite 2.0.2. [#844](https://github.com/shakacode/react_on_rails/pull/845) by [justin808](https://github.com/justin808) with help from ](https://github.com/robwise)
520
555
  - Logging no longer occurs when trace is turned to false. [#845](https://github.com/shakacode/react_on_rails/pull/845) by [conturbo](https://github.com/Conturbo)
521
556
 
522
557
  ## [8.0.0-beta.2] - 2017-05-08
523
558
 
524
- ### Changed
559
+ #### Changed
525
560
  Removed unnecessary values in default paths.yml files for generators. [#834](https://github.com/shakacode/react_on_rails/pull/834) by [justin808](https://github.com/justin808).
526
561
 
527
562
  ## [8.0.0-beta.1] - 2017-05-03
528
563
 
529
- ### Added
564
+ #### Added
530
565
  Support for WebpackerLite in the generators. [#822](https://github.com/shakacode/react_on_rails/pull/822) by [kaizencodes](https://github.com/kaizencodes) and [justin808](https://github.com/justin808).
531
566
 
532
- ### Changed
567
+ #### Changed
533
568
  Breaking change is that the default value of symlink_non_digested_assets_regex has changed from this
534
569
  old value to nil. This is a breaking change if you didn't have this value set in your
535
570
  config/initializers/react_on_rails.rb file and you need this because you're using webpack's CSS
@@ -549,65 +584,65 @@ Same as 7.0.1.
549
584
  *Accidental release of beta gem here*
550
585
 
551
586
  ## [7.0.1] - 2017-04-27
552
- ### Fixed
587
+ #### Fixed
553
588
  - Fix to handle nil values in json_safe_and_pretty [#823](https://github.com/shakacode/react_on_rails/pull/823) by [dzirtusss](https://github.com/dzirtusss)
554
589
 
555
590
  ## [7.0.0] - 2017-04-25
556
- ### Changed
591
+ #### Changed
557
592
  - Any version differences in gem and node package for React on Rails throw an error [#821](https://github.com/shakacode/react_on_rails/pull/821) by [justin808](https://github.com/justin808)
558
593
 
559
- ### Fixed
594
+ #### Fixed
560
595
  - Fixes serious performance regression when using String props for rendering. [#821](https://github.com/shakacode/react_on_rails/pull/821) by [justin808](https://github.com/justin808)
561
596
 
562
597
  ## [6.10.1] - 2017-04-23
563
- ### Fixed
598
+ #### Fixed
564
599
  - Improve json conversion with tests and support for older Rails 3.x. [#787](https://github.com/shakacode/react_on_rails/pull/787) by [cheremukhin23](https://github.com/cheremukhin23) and [Ynote](https://github.com/Ynote).
565
600
 
566
601
  ## [6.10.0] - 2017-04-13
567
602
 
568
- ### Added
603
+ #### Added
569
604
  - Add an ability to return multiple HTML strings in a `Hash` as a result of `react_component` method call. Allows to build `<head>` contents with [React Helmet](https://github.com/nfl/react-helmet). [#800](https://github.com/shakacode/react_on_rails/pull/800) by [udovenko](https://github.com/udovenko).
570
605
 
571
- ### Fixed
606
+ #### Fixed
572
607
  - Fix PropTypes, createClass deprecation warnings for React 15.5.x. [#804](https://github.com/shakacode/react_on_rails/pull/804) by [udovenko ](https://github.com/udovenko).
573
608
 
574
609
  ## [6.9.3] - 2017-04-03
575
610
 
576
- ### Fixed
611
+ #### Fixed
577
612
  - Removed call of to_json on strings when formatting props. [#791](https://github.com/shakacode/react_on_rails/pull/791) by [justin808](https://github.com/justin808).
578
613
 
579
614
  ## [6.9.2] - 2017-04-02
580
615
 
581
- ### Changed
616
+ #### Changed
582
617
  - Update version_checker.rb to `logger.error` rather than `logger.warn` for gem/npm version mismatch. [#788](https://github.com/shakacode/react_on_rails/issues/788) by [justin808](https://github.com/justin808).
583
618
 
584
- ### Fixed
619
+ #### Fixed
585
620
  - Remove pretty formatting of JSON in development. [#789](https://github.com/shakacode/react_on_rails/pull/789) by [justin808](https://github.com/justin808)
586
621
  - Clear hydrated stores with each server rendered block. [#785](https://github.com/shakacode/react_on_rails/pull/785) by [udovenko](https://github.com/udovenko)
587
622
 
588
623
  ## [6.9.1] - 2017-03-30
589
624
 
590
- ### Fixed
625
+ #### Fixed
591
626
  - Fixes Crash in Development for String Props. [#784](https://github.com/shakacode/react_on_rails/issues/784) by [justin808](https://github.com/justin808).
592
627
 
593
628
  ## [6.9.0] - 2017-03-29
594
629
 
595
- ### Fixed
630
+ #### Fixed
596
631
  - Fixed error in the release script. [#767](https://github.com/shakacode/react_on_rails/issues/767) by [isolo](https://github.com/isolo).
597
632
 
598
- ### Changed
633
+ #### Changed
599
634
  - Use <script type="application/json"> for props and store instead of hidden div. [#775] (https://github.com/shakacode/react_on_rails/pull/775) by [cheremukhin23](https://github.com/cheremukhin23).
600
635
 
601
- ### Added
636
+ #### Added
602
637
  - Add option to specify i18n_yml_dir in order to include only subset of locale files when generating translations.js & default.js for react-intl.
603
638
  [#777](https://github.com/shakacode/react_on_rails/pull/777) by [danijel](https://github.com/danijel).
604
639
 
605
640
  ## [6.8.2] - 2017-03-24
606
- ### Fixed
641
+ #### Fixed
607
642
  - Change webpack output path to absolute and update webpack to version ^2.3.1. [#771](https://github.com/shakacode/react_on_rails/pull/771) by [cheremukhin23](https://github.com/cheremukhin23).
608
643
 
609
644
  ## [6.8.1] - 2017-03-21
610
- ### Fixed
645
+ #### Fixed
611
646
  - Fixed error "The node you're attempting to unmount was rendered by another copy of React." [#706](https://github.com/shakacode/react_on_rails/issues/706) when navigating to cached page using Turbolinks [#763](https://github.com/shakacode/react_on_rails/pull/763) by [szyablitsky](https://github.com/szyablitsky).
612
647
 
613
648
  ## [6.8.0] - 2017-03-06
@@ -615,7 +650,7 @@ Same as 7.0.1.
615
650
  - Converted to Webpack v2 for generators, tests, and all example code. [#742](https://github.com/shakacode/react_on_rails/pull/742) by [justin808](https://github.com/justin808).
616
651
 
617
652
  ## [6.7.2] - 2017-03-05
618
- ### Improved
653
+ #### Improved
619
654
  - Improve i18n Integration with a better error message if the value of the i18n directory is invalid. [#748](https://github.com/shakacode/react_on_rails/pull/748) by [justin808](https://github.com/justin808).
620
655
 
621
656
  ## [6.7.1] - 2017-02-28
@@ -623,7 +658,7 @@ No changes other than a test fix.
623
658
 
624
659
  ## [6.7.0] - 2017-02-28
625
660
 
626
- ### IMPORTANT
661
+ #### IMPORTANT
627
662
  - If you installed 6.6.0, you will need to comment out the line matching i18n_dir unless you are using this feature. 6.7.1 will give you an error like:
628
663
 
629
664
  ```
@@ -636,32 +671,32 @@ Commenting out this line addresses the issue:
636
671
  config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n")
637
672
  ```
638
673
 
639
- ### Added
674
+ #### Added
640
675
  - Allow using rake task to generate javascript locale files. The test helper automatically creates the localization files when needed. [#717](https://github.com/shakacode/react_on_rails/pull/717) by [JasonYCHuang](https://github.com/JasonYCHuang).
641
676
 
642
- ### Fixed
677
+ #### Fixed
643
678
  - Upgrade Rails to 4.2.8 to fix security vulnerabilities in 4.2.5. [#735](https://github.com/shakacode/react_on_rails/pull/735) by [hrishimittal](https://github.com/hrishimittal).
644
679
  - Fix spec failing due to duplicate component. [#734](https://github.com/shakacode/react_on_rails/pull/734) by [hrishimittal](https://github.com/hrishimittal).
645
680
 
646
681
  ## [6.6.0] - 2017-02-18
647
- ### Added
682
+ #### Added
648
683
  - Switched to yarn! [#715](https://github.com/shakacode/react_on_rails/pull/715) by [squadette](https://github.com/squadette).
649
684
 
650
685
  ## [6.5.1] - 2017-02-11
651
- ### Fixed
686
+ #### Fixed
652
687
  - Allow using gem without sprockets. [#671](https://github.com/shakacode/react_on_rails/pull/671) by [fc-arny](https://github.com/fc-arny).
653
688
  - Fixed issue [#706](https://github.com/shakacode/react_on_rails/issues/706) with "flickering" components when they are unmounted too early [#709](https://github.com/shakacode/react_on_rails/pull/709) by [szyablitsky](https://github.com/szyablitsky).
654
689
  - Small formatting fix for errors [#703](https://github.com/shakacode/react_on_rails/pull/703) by [justin808](https://github.com/justin808).
655
690
 
656
691
  ## [6.5.0] - 2017-01-31
657
- ### Added
692
+ #### Added
658
693
  - Allow generator function to return Object with property `renderedHtml` (already could return Object with props `redirectLocation, error`) rather than a React component or a function that returns a React component. One reason to use a generator function is that sometimes in server rendering, specifically with React Router v4, you need to return the result of calling ReactDOMServer.renderToString(element). [#689](https://github.com/shakacode/react_on_rails/issues/689) by [justin808](https://github.com/justin808).
659
694
 
660
- ### Fixed
695
+ #### Fixed
661
696
  - Fix incorrect "this" references of Node.js SSR [#690](https://github.com/shakacode/react_on_rails/issues/689) by [nostophilia](https://github.com/nostophilia).
662
697
 
663
698
  ## [6.4.2] - 2017-01-17
664
- ### Fixed
699
+ #### Fixed
665
700
  - Added OS detection for install generator, system call for Windows and unit-tests for it. [#666](https://github.com/shakacode/react_on_rails/pull/666) by [GeorgeGorbanev](https://github.com/GeorgeGorbanev).
666
701
 
667
702
  ## [6.4.1] - 2017-1-17
@@ -669,17 +704,17 @@ No changes.
669
704
 
670
705
  ## [6.4.0] - 2017-1-12
671
706
 
672
- ### Possible Breaking Change
707
+ #### Possible Breaking Change
673
708
  - Since foreman is no longer a dependency of the React on Rails gem, please run `gem install foreman`. If you are using rvm, you may wish to run `rvm @global do gem install foreman` to install foreman for all your gemsets.
674
709
 
675
- ### Fixed
710
+ #### Fixed
676
711
  - Removed foreman as a dependency. [#678](https://github.com/shakacode/react_on_rails/pull/678) by [x2es](https://github.com/x2es).
677
712
 
678
- ### Added
713
+ #### Added
679
714
  - Automatically generate __i18n__ javascript files for `react-intl` when the serve starts up. [#642](https://github.com/shakacode/react_on_rails/pull/642) by [JasonYCHuang](https://github.com/JasonYCHuang).
680
715
 
681
716
  ## [6.3.5] - 2017-1-6
682
- ### Fixed
717
+ #### Fixed
683
718
  - The redux generator now creates a HelloWorld component that uses redux rather than local state. [#669](https://github.com/shakacode/react_on_rails/issues/669) by [justin808](https://github.com/justin808).
684
719
 
685
720
  ## [6.3.4] - 2016-12-25
@@ -1087,9 +1122,12 @@ Best done with Object destructing:
1087
1122
  - Turbolinks support.
1088
1123
 
1089
1124
  ##### Fixed
1090
- - Fix several generator related issues.
1125
+ - Fix several generator-related issues.
1091
1126
 
1092
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/13.3.5...master
1127
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.0.0...master
1128
+ [14.0.0]: https://github.com/shakacode/react_on_rails/compare/13.4.1...14.0.0
1129
+ [13.4.1]: https://github.com/shakacode/react_on_rails/compare/13.4.0...13.4.1
1130
+ [13.4.0]: https://github.com/shakacode/react_on_rails/compare/13.3.5...13.4.0
1093
1131
  [13.3.5]: https://github.com/shakacode/react_on_rails/compare/13.3.4...13.3.5
1094
1132
  [13.3.4]: https://github.com/shakacode/react_on_rails/compare/13.3.3...13.3.4
1095
1133
  [13.3.3]: https://github.com/shakacode/react_on_rails/compare/13.3.2...13.3.3
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- gem "shakapacker", "6.5.1"
3
+ gem "shakapacker", "7.2.1"
4
4
  gem "bootsnap", require: false
5
- gem "rails", "~> 7.0"
5
+ gem "rails", "~> 7.1"
6
+
6
7
  gem "sqlite3"
7
8
  gem "sass-rails", "~> 6.0"
8
9
  gem "uglifier"
9
10
  gem "jquery-rails"
10
- gem "puma", "~> 5.0"
11
- gem "bundler", "2.4.9"
11
+ gem "puma", "~> 6.0"
12
+ gem "bundler", "2.5.3"
12
13
 
13
14
  # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
14
15
  gem "turbolinks" if ENV["DISABLE_TURBOLINKS"].nil? || ENV["DISABLE_TURBOLINKS"].strip.empty?
@@ -29,9 +30,9 @@ group :development, :test do
29
30
  gem "pry-doc"
30
31
  gem "pry-rails"
31
32
  gem "pry-rescue"
32
- gem "rubocop", "1.14.0", require: false
33
- gem "rubocop-performance", require: false
34
- gem "rubocop-rspec", require: false
33
+ gem "rubocop", "~>1.59", require: false
34
+ gem "rubocop-performance", "~>1.20.0", require: false
35
+ gem "rubocop-rspec", "~>2.26", require: false
35
36
  gem "scss_lint", require: false
36
37
  gem "spring", "~> 4.0"
37
38
  end
@@ -46,6 +47,6 @@ group :test do
46
47
  gem "rspec_junit_formatter"
47
48
  gem "rspec-rails"
48
49
  gem "rspec-retry"
49
- gem "selenium-webdriver"
50
- gem "webdrivers"
50
+ gem "selenium-webdriver", "4.9.0"
51
+ gem "webdrivers", "5.3.0"
51
52
  end
data/README.md CHANGED
@@ -63,7 +63,7 @@ See [Rails/Webpacker React Integration Options](https://www.shakacode.com/react-
63
63
 
64
64
  ## Online demo
65
65
  * See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
66
- * A deployed version of the project `spec/dummy` which demonstrates several uses of `react_on_rails` is available on heroku [through this link](https://ror-spec-dummy.herokuapp.com/)
66
+ * A deployed version of the project `spec/dummy`, which demonstrates several uses of `react_on_rails`, will soon be available on [Control Plane through this link](https://ror-spec-dummy.reactrails.com/)
67
67
 
68
68
  ## ShakaCode Forum Premium Content
69
69
  _Requires creating a free account._
@@ -73,7 +73,7 @@ _Requires creating a free account._
73
73
 
74
74
  ## Prerequisites
75
75
 
76
- Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 2.7
76
+ Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
77
77
 
78
78
  # Support
79
79
 
@@ -113,6 +113,11 @@ The following companies support our open source projects, and ShakaCode uses the
113
113
  <img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
114
114
  </picture>
115
115
  </a>
116
+ <a href="https://controlplane.com">
117
+ <picture>
118
+ <img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px">
119
+ </picture>
120
+ </a>
116
121
  <br />
117
122
  <a href="https://www.browserstack.com">
118
123
  <picture>
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require_relative "generator_helper"
5
+
6
+ module ReactOnRails
7
+ module Generators
8
+ class AdaptForOlderShakapackerGenerator < Rails::Generators::Base
9
+ include GeneratorHelper
10
+ Rails::Generators.hide_namespace(namespace)
11
+
12
+ def change_spelling_to_webpacker
13
+ puts "Change spelling to webpacker v7"
14
+ files = %w[
15
+ Procfile.dev
16
+ Procfile.dev-static
17
+ config/shakapacker.yml
18
+ config/initializers/react_on_rails.rb
19
+ ]
20
+ files.each { |file| gsub_file(file, "shakapacker", "webpacker") }
21
+ end
22
+
23
+ def rename_config_file
24
+ puts "Rename to config/webpacker.yml"
25
+ puts "Renaming shakapacker.yml into webpacker.yml"
26
+ FileUtils.mv("config/shakapacker.yml", "config/webpacker.yml")
27
+ end
28
+
29
+ def modify_requiring_webpack_config_in_js
30
+ puts "Update commonWebpackConfig.js to follow the Shakapacker v6 interface"
31
+ file = "config/webpack/commonWebpackConfig.js"
32
+ gsub_file(file, "const baseClientWebpackConfig = generateWebpackConfig();\n\n", "")
33
+ gsub_file(
34
+ file,
35
+ "const { generateWebpackConfig, merge } = require('shakapacker');",
36
+ "const { webpackConfig: baseClientWebpackConfig, merge } = require('shakapacker');"
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -65,10 +65,10 @@ module ReactOnRails
65
65
  end
66
66
  end
67
67
 
68
- def copy_webpacker_config
69
- puts "Adding Webpacker v6 config"
68
+ def copy_shakapacker_config
69
+ puts "Adding Shakapacker v7 config file"
70
70
  base_path = "base/base/"
71
- base_files = %w[config/webpacker.yml]
71
+ base_files = %w[config/shakapacker.yml]
72
72
  base_files.each { |file| copy_file("#{base_path}#{file}", file) }
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ module ReactOnRails
77
77
  end
78
78
 
79
79
  def add_yarn_dependencies
80
- major_minor_patch_only = /\A\d+\.\d+\.\d+\z/.freeze
80
+ major_minor_patch_only = /\A\d+\.\d+\.\d+\z/
81
81
  if ReactOnRails::VERSION.match?(major_minor_patch_only)
82
82
  run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact"
83
83
  else
@@ -91,7 +91,15 @@ module ReactOnRails
91
91
  babel-plugin-macros"
92
92
 
93
93
  puts "Adding CSS handlers"
94
- run "yarn add css-loader css-minimizer-webpack-plugin mini-css-extract-plugin style-loader"
94
+
95
+ # css_minimizer_webpack_plugin version 6 only supports Nodejs v18+
96
+ # When we bump our minimum Nodejs version to 18, we can remove this logic
97
+ # and install css_minimizer_webpack_plugin directly.
98
+ node_major_version = `node -v`.match(/^v(\d{,2})\./)[1]&.to_i
99
+ css_minimizer_webpack_plugin_version = node_major_version >= 18 ? "" : "@<6.0.0"
100
+ css_minimizer_webpack_plugin = "css-minimizer-webpack-plugin#{css_minimizer_webpack_plugin_version}"
101
+
102
+ run "yarn add css-loader '#{css_minimizer_webpack_plugin}' mini-css-extract-plugin style-loader"
95
103
 
96
104
  puts "Adding dev dependencies"
97
105
  run "yarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh"
@@ -132,50 +140,6 @@ module ReactOnRails
132
140
  ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
133
141
  STR
134
142
 
135
- def self.helpful_message
136
- <<-MSG.strip_heredoc
137
-
138
- What to do next:
139
-
140
- - See the documentation on https://github.com/shakacode/shakapacker#webpack-configuration
141
- for how to customize the default webpack configuration.
142
-
143
- - Include your webpack assets to your application layout.
144
-
145
- <%= javascript_pack_tag 'hello-world-bundle' %>
146
-
147
- - To start Rails server run:
148
-
149
- ./bin/dev # Running with HMR
150
-
151
- or
152
-
153
- ./bin/dev-static # Running with statically created bundles, without HMR
154
-
155
- - To server render, change this line app/views/hello_world/index.html.erb to
156
- `prerender: true` to see server rendering (right click on page and select "view source").
157
-
158
- <%= react_component("HelloWorldApp", props: @hello_world_props, prerender: true) %>
159
-
160
- Alternative steps to run the app:
161
-
162
- - Run `rails s` to start the Rails server.
163
-
164
- - Run bin/webpacker-dev-server to start the Webpack dev server for compilation of Webpack
165
- assets as soon as you save. This default setup with the dev server does not work
166
- for server rendering
167
-
168
- - Visit http://localhost:3000/hello_world and see your React On Rails app running!
169
-
170
- - To turn on HMR, edit config/webpacker.yml and set HMR to true. Restart the rails server
171
- and bin/webpacker-dev-server. Or use Procfile.dev.
172
- MSG
173
- end
174
-
175
- def print_helpful_message
176
- GeneratorMessages.add_info(self.class.helpful_message)
177
- end
178
-
179
143
  private
180
144
 
181
145
  # From https://github.com/rails/rails/blob/4c940b2dbfb457f67c6250b720f63501d74a45fd/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -39,7 +39,7 @@ module ReactOnRails
39
39
 
40
40
  hello_world_index = File.join(destination_root, "app", "views", "hello_world", "index.html.erb")
41
41
  hello_world_contents = File.read(hello_world_index)
42
- new_hello_world_contents = hello_world_contents.gsub(/prerender: false/,
42
+ new_hello_world_contents = hello_world_contents.gsub("prerender: false",
43
43
  "prerender: true")
44
44
 
45
45
  File.open(hello_world_index, "w+") { |f| f.puts new_hello_world_contents }