react_on_rails 11.0.5 → 13.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +338 -0
  3. data/.eslintignore +2 -1
  4. data/.eslintrc +32 -3
  5. data/.github/FUNDING.yml +1 -0
  6. data/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
  7. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  8. data/.github/PULL_REQUEST_TEMPLATE.md +19 -0
  9. data/.github/workflows/lint-js-and-ruby.yml +54 -0
  10. data/.github/workflows/main.yml +183 -0
  11. data/.github/workflows/package-js-tests.yml +35 -0
  12. data/.github/workflows/rspec-package-specs.yml +46 -0
  13. data/.gitignore +3 -4
  14. data/.prettierignore +14 -0
  15. data/.prettierrc +20 -0
  16. data/.rubocop.yml +76 -34
  17. data/.travis.yml +15 -22
  18. data/CHANGELOG.md +443 -55
  19. data/CONTRIBUTING.md +62 -80
  20. data/Gemfile +1 -35
  21. data/Gemfile.development_dependencies +50 -0
  22. data/KUDOS.md +4 -1
  23. data/{docs/LICENSE.md → LICENSE.md} +1 -1
  24. data/NEWS.md +14 -4
  25. data/REACT-ON-RAILS-PRO-LICENSE +95 -0
  26. data/README.md +107 -802
  27. data/Rakefile +1 -8
  28. data/SUMMARY.md +51 -29
  29. data/book.json +5 -5
  30. data/docs/{basics/generator.md → additional-details/generator-details.md} +5 -13
  31. data/docs/{basics/installation-overview.md → additional-details/manual-installation-overview.md} +9 -14
  32. data/docs/{basics → additional-details}/migrating-from-react-rails.md +1 -1
  33. data/docs/additional-details/recommended-project-structure.md +69 -0
  34. data/docs/additional-details/tips-for-usage-with-sp6.md +15 -0
  35. data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +10 -0
  36. data/docs/api/javascript-api.md +35 -6
  37. data/docs/api/redux-store-api.md +102 -0
  38. data/docs/api/view-helpers-api.md +133 -0
  39. data/docs/contributor-info/errors-with-hooks.md +45 -0
  40. data/docs/contributor-info/linters.md +5 -6
  41. data/docs/contributor-info/pull-requests.md +42 -0
  42. data/docs/contributor-info/releasing.md +1 -1
  43. data/docs/deployment/heroku-deployment.md +39 -0
  44. data/docs/getting-started.md +196 -0
  45. data/docs/guides/client-vs-server-rendering.md +27 -0
  46. data/docs/guides/configuration.md +289 -0
  47. data/docs/guides/deployment.md +5 -0
  48. data/docs/guides/file-system-based-automated-bundle-generation.md +197 -0
  49. data/docs/guides/hmr-and-hot-reloading-with-the-webpack-dev-server.md +104 -0
  50. data/docs/guides/how-react-on-rails-works.md +44 -0
  51. data/docs/guides/how-to-conditionally-server-render-based-on-device-type.md +40 -0
  52. data/docs/guides/how-to-use-different-files-for-client-and-server-rendering.md +98 -0
  53. data/docs/guides/i18n.md +87 -0
  54. data/docs/guides/installation-into-an-existing-rails-app.md +66 -0
  55. data/docs/guides/minitest-configuration.md +31 -0
  56. data/docs/guides/rails-webpacker-react-integration-options.md +213 -0
  57. data/docs/guides/react-on-rails-overview.md +29 -0
  58. data/docs/guides/react-server-rendering.md +32 -0
  59. data/docs/guides/render-functions-and-railscontext.md +205 -0
  60. data/docs/guides/rspec-configuration.md +73 -0
  61. data/docs/guides/tutorial.md +371 -0
  62. data/docs/{basics → guides}/upgrading-react-on-rails.md +126 -3
  63. data/docs/guides/webpack-configuration.md +42 -0
  64. data/docs/home.md +23 -0
  65. data/docs/javascript/asset-pipeline.md +12 -0
  66. data/docs/{additional-reading → javascript}/code-splitting.md +21 -11
  67. data/docs/javascript/converting-from-custom-webpack-config-to-rails-webpacker-config.md +10 -0
  68. data/docs/javascript/credits.md +10 -0
  69. data/docs/{additional-reading → javascript}/images.md +5 -6
  70. data/docs/javascript/react-helmet.md +100 -0
  71. data/docs/javascript/react-router.md +90 -0
  72. data/docs/{additional-reading → javascript}/server-rendering-tips.md +15 -12
  73. data/docs/javascript/troubleshooting-when-using-shakapacker.md +77 -0
  74. data/docs/{additional-reading → javascript}/webpack.md +2 -2
  75. data/docs/misc/articles.md +20 -0
  76. data/docs/misc/doctrine.md +5 -6
  77. data/docs/outdated/deferred-rendering.md +39 -0
  78. data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +4 -4
  79. data/docs/{additional-reading → outdated}/rails-assets.md +12 -20
  80. data/docs/{misc → outdated}/rails3.md +2 -2
  81. data/docs/rails/convert-rails-5-api-only-app.md +19 -0
  82. data/docs/rails/rails-engine-integration.md +32 -0
  83. data/docs/{additional-reading → rails}/rails_view_rendering_from_inline_javascript.md +2 -1
  84. data/docs/{additional-reading → rails}/turbolinks.md +13 -1
  85. data/docs/react-on-rails-pro/react-on-rails-pro.md +43 -0
  86. data/docs/testimonials/hvmn.md +25 -0
  87. data/docs/testimonials/resortpass.md +13 -0
  88. data/docs/testimonials/testimonials.md +28 -0
  89. data/jest.config.js +4 -0
  90. data/lib/generators/USAGE +1 -1
  91. data/lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb +41 -0
  92. data/lib/generators/react_on_rails/base_generator.rb +55 -43
  93. data/lib/generators/react_on_rails/bin/dev +30 -0
  94. data/lib/generators/react_on_rails/bin/dev-static +30 -0
  95. data/lib/generators/react_on_rails/dev_tests_generator.rb +4 -3
  96. data/lib/generators/react_on_rails/generator_helper.rb +8 -6
  97. data/lib/generators/react_on_rails/generator_messages.rb +40 -0
  98. data/lib/generators/react_on_rails/install_generator.rb +37 -0
  99. data/lib/generators/react_on_rails/templates/.eslintrc +3 -1
  100. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +4 -6
  101. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static +9 -0
  102. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +21 -40
  103. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +4 -0
  104. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorldServer.js +5 -0
  105. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/server-bundle.js +8 -0
  106. data/lib/generators/react_on_rails/templates/base/base/app/views/layouts/hello_world.html.erb +2 -1
  107. data/lib/generators/react_on_rails/templates/base/base/babel.config.js.tt +32 -0
  108. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +20 -4
  109. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +62 -0
  110. data/lib/generators/react_on_rails/templates/base/base/config/webpack/clientWebpackConfig.js.tt +17 -0
  111. data/lib/generators/react_on_rails/templates/base/base/config/webpack/commonWebpackConfig.js.tt +17 -0
  112. data/lib/generators/react_on_rails/templates/base/base/config/webpack/development.js.tt +25 -0
  113. data/lib/generators/react_on_rails/templates/base/base/config/webpack/production.js.tt +9 -0
  114. data/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt +117 -0
  115. data/lib/generators/react_on_rails/templates/base/base/config/webpack/test.js.tt +9 -0
  116. data/lib/generators/react_on_rails/templates/base/base/config/webpack/webpack.config.js.tt +15 -0
  117. data/lib/generators/react_on_rails/templates/base/base/config/webpack/webpackConfig.js.tt +36 -0
  118. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +8 -2
  119. data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +1 -1
  120. data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb +2 -2
  121. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +6 -9
  122. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
  123. data/lib/react_on_rails/configuration.rb +198 -145
  124. data/lib/react_on_rails/error.rb +2 -0
  125. data/lib/react_on_rails/git_utils.rb +5 -3
  126. data/lib/react_on_rails/{react_on_rails_helper.rb → helper.rb} +201 -190
  127. data/lib/react_on_rails/json_output.rb +1 -1
  128. data/lib/react_on_rails/json_parse_error.rb +28 -0
  129. data/lib/react_on_rails/locales/base.rb +169 -0
  130. data/lib/react_on_rails/locales/to_js.rb +33 -0
  131. data/lib/react_on_rails/locales/to_json.rb +23 -0
  132. data/lib/react_on_rails/packs_generator.rb +234 -0
  133. data/lib/react_on_rails/prerender_error.rb +35 -27
  134. data/lib/react_on_rails/react_component/render_options.rb +64 -9
  135. data/lib/react_on_rails/server_rendering_js_code.rb +55 -0
  136. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +126 -76
  137. data/lib/react_on_rails/server_rendering_pool.rb +0 -1
  138. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +9 -8
  139. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +17 -0
  140. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +13 -12
  141. data/lib/react_on_rails/test_helper.rb +24 -3
  142. data/lib/react_on_rails/utils.rb +94 -25
  143. data/lib/react_on_rails/version.rb +1 -1
  144. data/lib/react_on_rails/version_checker.rb +5 -1
  145. data/lib/react_on_rails/version_syntax_converter.rb +14 -12
  146. data/lib/react_on_rails/webpacker_utils.rb +105 -5
  147. data/lib/react_on_rails.rb +8 -2
  148. data/lib/tasks/assets.rake +28 -60
  149. data/lib/tasks/generate_packs.rake +11 -0
  150. data/lib/tasks/locale.rake +5 -4
  151. data/package-scripts.yml +49 -0
  152. data/package.json +52 -47
  153. data/rakelib/docker.rake +0 -5
  154. data/rakelib/dummy_apps.rake +5 -8
  155. data/rakelib/example_type.rb +12 -3
  156. data/rakelib/examples.rake +5 -4
  157. data/rakelib/lint.rake +5 -16
  158. data/rakelib/node_package.rake +2 -2
  159. data/rakelib/release.rake +37 -23
  160. data/rakelib/run_rspec.rake +16 -44
  161. data/rakelib/task_helpers.rb +16 -4
  162. data/react_on_rails.gemspec +6 -22
  163. data/tsconfig.json +14 -0
  164. data/webpackConfigLoader.js +5 -4
  165. data/yarn.lock +5935 -3106
  166. metadata +122 -272
  167. data/Gemfile.rails32 +0 -74
  168. data/docs/additional-reading/asset-pipeline.md +0 -20
  169. data/docs/additional-reading/babel.md +0 -5
  170. data/docs/additional-reading/caching-and-performance.md +0 -4
  171. data/docs/additional-reading/heroku-deployment.md +0 -92
  172. data/docs/additional-reading/hot-reloading-rails-development.md +0 -57
  173. data/docs/additional-reading/node-server-rendering.md +0 -5
  174. data/docs/additional-reading/rails-engine-integration.md +0 -34
  175. data/docs/additional-reading/react-helmet.md +0 -80
  176. data/docs/additional-reading/react-router.md +0 -113
  177. data/docs/additional-reading/recommended-project-structure.md +0 -49
  178. data/docs/additional-reading/rspec-configuration.md +0 -56
  179. data/docs/additional-reading/webpack-dev-server.md +0 -15
  180. data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
  181. data/docs/api/ruby-api.md +0 -8
  182. data/docs/basics/configuration.md +0 -163
  183. data/docs/basics/i18n.md +0 -77
  184. data/docs/tutorial.md +0 -220
  185. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
  186. data/lib/react_on_rails/assets_precompile.rb +0 -150
  187. data/lib/react_on_rails/locales_to_js.rb +0 -134
  188. data/ruby-lint.yml +0 -25
  189. /data/docs/{additional-reading → additional-details}/updating-dependencies.md +0 -0
  190. /data/docs/{additional-reading → deployment}/elastic-beanstalk.md +0 -0
  191. /data/docs/{additional-reading → javascript}/angular-js-integration-migration.md +0 -0
  192. /data/docs/{additional-reading → javascript}/capistrano-deployment.md +0 -0
  193. /data/docs/{additional-reading → javascript}/foreman-issues.md +0 -0
  194. /data/docs/{additional-reading → javascript}/node-dependencies-and-npm.md +0 -0
  195. /data/docs/{additional-reading → javascript}/react-and-redux.md +0 -0
  196. /data/docs/{additional-reading → javascript}/troubleshooting-when-using-webpacker.md +0 -0
  197. /data/docs/{additional-reading → javascript}/webpack-v1-notes.md +0 -0
  198. /data/docs/{coding-style → misc}/style.md +0 -0
  199. /data/docs/{additional-reading → misc}/tips.md +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1e2e9cfdc5d161ab3706f779c18c8ce1a166b066
4
- data.tar.gz: 6211ecc33d60cccc7d385ddcc7550a31f1502d43
2
+ SHA256:
3
+ metadata.gz: 545e97728f6633e1adc5091f8e1a72c377ce8d8c809ca8b6378c0b1bffe62c7d
4
+ data.tar.gz: 06a83f533ee9518518afeb63a31191861298f92a2ec36b876914347de0a0f960
5
5
  SHA512:
6
- metadata.gz: 3cac9f496b6163da14528c717ef9c6a87ad15d11f87cab027d3af08ebe48121345f62264cd42dcd2cb64e847a38bc07a2ccb6b5951a98b9ca4737414e1a5afe2
7
- data.tar.gz: e692554e9375d8c789894624c86639fcc442314ccc024050fca0ee4e371a7f05e047188bed0cf24f6d32497b7ee454ad9cba07fc1d062821c720a0274d4ddd50
6
+ metadata.gz: 9bc25f3009cc3775d59d456e2009fe3c7f692a13268bf559a1059547c8c56998d8c0c2856a9b8e43079afa6ffa3705a6c1f613ecf9864ae6b3cc0697c5f46ac7
7
+ data.tar.gz: 860f4fc51d1bef3f7cc4599335062881681b3acd70e6f1104ecbc24e128e175ddb0b3aa44ee6c2b0d36c2596c6d118eb1ded0ec92fcab8781efa2233c2cd3875
@@ -0,0 +1,338 @@
1
+ # CircleCI is not longer in use by this repository & this file is now for reference only.
2
+ version: 2
3
+
4
+ aliases:
5
+ - &docker-image
6
+ - image: circleci/ruby:2.7-node-browsers
7
+
8
+ # Print critical data and executables versions.
9
+ - &print-system-info
10
+ name: Print system information
11
+ command: |
12
+ echo "Linux release: "; cat /etc/issue
13
+ echo "Current user: "; whoami
14
+ echo "Current directory: "; pwd
15
+ echo "Ruby version: "; ruby -v
16
+ echo "Node version: "; node -v
17
+ echo "Yarn version: "; yarn --version
18
+ echo "Bundler version: "; bundle --version
19
+ - &lint-js
20
+ name: Linting of JS
21
+ command: yarn start lint
22
+
23
+ - &lint-ruby
24
+ name: Linting of Ruby
25
+ command: bundle exec rubocop
26
+
27
+ - &format
28
+ name: Check formatting
29
+ command: yarn start format.listDifferent
30
+
31
+ # Install/update Node modules for renderer package unless existing set of modules is satisfying Yarn.
32
+ - &install-package-node-modules
33
+ name: Install Node modules with Yarn for renderer package
34
+ command: |
35
+ sudo yarn global add yalc
36
+ yarn install --no-progress --no-emoji
37
+ yarn run eslint -v
38
+
39
+ # Install/update Node modules for dummy app unless existing set of modules is satisfying Yarn.
40
+ - &install-dummy-app-node-modules
41
+ name: Install Node modules with Yarn for dummy app
42
+ command: cd spec/dummy && yarn install --no-progress --no-emoji
43
+
44
+ # Setup yarn links for react-on-rails
45
+ - &install-yalc-publish
46
+ name: yalc publish for react-on-rails
47
+ command: yalc publish
48
+
49
+ - &install-yalc-add-react-on-rails
50
+ name: yalc add react-on-rails
51
+ command: cd spec/dummy && yalc add react-on-rails
52
+
53
+ # Install ruby gems unless existing set of gems is satisfying bundler.
54
+ - &install-dummy-app-ruby-gems
55
+ name: Install Ruby Gems for dummy app
56
+ command: |
57
+ gem install bundler:2.4.17
58
+ echo "Bundler version: "; bundle --version
59
+ cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
60
+
61
+ # Install ruby gems unless existing set of gems is satisfying bundler.
62
+ - &install-package-ruby-gems
63
+ name: Install Ruby Gems for package
64
+ command: |
65
+ gem install bundler:2.4.17
66
+ echo "Bundler version: "; bundle --version
67
+ bundle lock --add-platform 'x86_64-linux'
68
+ bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
69
+
70
+ # Restore node_modules dir from cache using yarn.lock checksum as a key.
71
+ - &restore-package-node-modules-cache
72
+ name: Restore cached node_modules directory
73
+ keys:
74
+ - v5-package-node-modules-cache-{{ checksum "yarn.lock" }}
75
+
76
+ # Restore spec/dummy/node_modules dir from cache using yarn.lock checksum as a key.
77
+ - &restore-dummy-app-node-modules-cache
78
+ name: Restore cached spec/dummy/node_modules directory
79
+ keys:
80
+ - v5-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
81
+
82
+ # Restore vendor/bundle dir from cache using Gemfile.lock checksum as a key.
83
+ - &restore-dummy-app-gem-cache
84
+ name: Restore cached Ruby Gems for dummy app
85
+ keys:
86
+ - v5-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
87
+
88
+ # Restore vendor/bundle dir from cache using react_on_rails.gemspec checksum as a key.
89
+ - &restore-package-gem-cache
90
+ name: Restore cached Ruby Gems for package
91
+ keys:
92
+ - v5-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
93
+
94
+ # NOTE: Sometimes CI generated docker images are not updated in time to keep up with the minimum required
95
+ # by chromedriver versions of Chrome. Just bump here Chrome version if chromedriver raises errors
96
+ - &install-latest-chrome
97
+ name: Ensure minimum required Chrome version
98
+ command: |
99
+ echo -e "Installed $(google-chrome --version)\n"
100
+ MINIMUM_REQUIRED_CHROME_VERSION=75
101
+ INSTALLED_CHROME_MAJOR_VERSION="$(google-chrome --version | tr ' .' '\t' | cut -f3)"
102
+ if [[ $INSTALLED_CHROME_MAJOR_VERSION < $MINIMUM_REQUIRED_CHROME_VERSION ]]; then
103
+ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
104
+ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
105
+ sudo apt-get update
106
+ sudo apt-get install google-chrome-stable
107
+ echo -e "\nInstalled $(google-chrome --version)"
108
+ fi
109
+
110
+ jobs:
111
+ # Lint all
112
+ lint-js-and-ruby:
113
+ docker: *docker-image
114
+ steps:
115
+ - checkout
116
+ - run: *print-system-info
117
+ - restore_cache: *restore-package-node-modules-cache
118
+ - restore_cache: *restore-package-gem-cache
119
+ - run: *install-package-ruby-gems
120
+ - run: *lint-ruby
121
+ - run: *lint-js
122
+ - run: *format
123
+
124
+ prettier:
125
+ docker: *docker-image
126
+ parallelism: 1
127
+ steps:
128
+ - checkout
129
+ - restore_cache: *restore-package-node-modules-cache
130
+ - run:
131
+ name: prettier
132
+ command: yarn start format.listDifferent
133
+
134
+ # Install Node modules for Renderer package with Yarn and save them to chache.
135
+ install-package-node-packages:
136
+ docker: *docker-image
137
+ steps:
138
+ - checkout
139
+ - run: *print-system-info
140
+ - restore_cache: *restore-package-node-modules-cache
141
+ - run: *install-package-node-modules
142
+ - save_cache:
143
+ name: Save root node_modules to cache
144
+ key: v5-package-node-modules-cache-{{ checksum "yarn.lock" }}
145
+ paths:
146
+ - node_modules
147
+
148
+
149
+ # Install Node modules for dummy app with Yarn and save them to cache.
150
+ install-dummy-app-node-packages:
151
+ docker: *docker-image
152
+ steps:
153
+ - checkout
154
+ - run: *print-system-info
155
+ - restore_cache: *restore-dummy-app-node-modules-cache
156
+ - run: *install-package-node-modules
157
+ - run: *install-yalc-publish
158
+ - run: *install-yalc-add-react-on-rails
159
+ - run: *install-dummy-app-node-modules
160
+ - save_cache:
161
+ name: Save spec/dummy/node_modules to cache
162
+ key: v5-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
163
+ paths:
164
+ - spec/dummy/node_modules
165
+ - spec/dummy/node_modules
166
+
167
+ # Install Ruby gems for package with Bundler and save them to cache.
168
+ install-package-ruby-gems:
169
+ docker: *docker-image
170
+ steps:
171
+ - checkout
172
+ - run: *print-system-info
173
+ - restore_cache: *restore-package-gem-cache
174
+ - run: *install-package-ruby-gems
175
+ - save_cache:
176
+ name: Save dummy app ruby gems to cache
177
+ key: v5-package-app-gem-cache-{{ checksum "react_on_rails.gemspec" }}
178
+ paths:
179
+ - vendor/bundle
180
+
181
+ # Install Ruby gems for dummy app with Bundler and save them to cache.
182
+ install-dummy-app-ruby-gems:
183
+ docker: *docker-image
184
+ steps:
185
+ - checkout
186
+ - run: *print-system-info
187
+ - restore_cache: *restore-dummy-app-gem-cache
188
+ - run: *install-dummy-app-ruby-gems
189
+ - save_cache:
190
+ name: Save dummy app ruby gems to cache
191
+ key: v5-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
192
+ paths:
193
+ - spec/dummy/vendor/bundle
194
+
195
+ # Build client and server bundles for dummy app with Webpack and save them to cache.
196
+ # NOTE: keeping around this cache in case we have multiple rspec suites in the future to tests
197
+ # different node renderers.
198
+ build-dummy-app-webpack-test-bundles:
199
+ docker: *docker-image
200
+ steps:
201
+ - checkout
202
+ - run: *print-system-info
203
+ - run: *install-package-node-modules
204
+ - run: *install-yalc-publish
205
+ - restore_cache: *restore-dummy-app-node-modules-cache
206
+ - run: *install-yalc-add-react-on-rails
207
+ - run: *install-dummy-app-node-modules
208
+ - run: *install-dummy-app-ruby-gems
209
+ - run:
210
+ name: generate file system-based packs
211
+ command: cd spec/dummy && bundle exec rake react_on_rails:generate_packs
212
+ - run:
213
+ name: Build test bundles for dummy app
214
+ command: cd spec/dummy && yarn run build:test
215
+ - save_cache:
216
+ name: Save test webpack bundles to cache (for build number checksum used by rspec job)
217
+ key: v5-dummy-app-webpack-bundle-{{ .Revision }}
218
+ paths:
219
+ - spec/dummy/public/webpack
220
+ # Run JS unit tests for Renderer package.
221
+ package-js-tests:
222
+ docker: *docker-image
223
+ steps:
224
+ - checkout
225
+ - run: *print-system-info
226
+ - restore_cache: *restore-package-node-modules-cache
227
+ - run: *install-package-node-modules
228
+ - run:
229
+ name: Run JS unit tests for Renderer package
230
+ command: yarn test
231
+
232
+ rspec-package-specs:
233
+ docker: *docker-image
234
+ steps:
235
+ - checkout
236
+ - run: *print-system-info
237
+ - restore_cache: *restore-package-gem-cache
238
+ - run: *install-package-ruby-gems
239
+ - run:
240
+ name: Run rspec tests
241
+ command: |
242
+ bundle exec rspec spec/react_on_rails
243
+ - store_test_results:
244
+ path: ~/rspec
245
+ - store_artifacts:
246
+ path: log/test.log
247
+
248
+ main:
249
+ docker: *docker-image
250
+ steps:
251
+ - checkout
252
+ - run: *print-system-info
253
+ - restore_cache: *restore-package-gem-cache
254
+ - restore_cache: *restore-dummy-app-gem-cache
255
+ - restore_cache:
256
+ name: Restore cached webpack bundles for dummy app
257
+ key: v5-dummy-app-webpack-bundle-{{ .Revision }}
258
+ - restore_cache: *restore-dummy-app-node-modules-cache
259
+ - restore_cache: *restore-package-node-modules-cache
260
+ - run: *install-package-node-modules
261
+ - run: *install-yalc-publish
262
+ - run: *install-yalc-add-react-on-rails
263
+ - run: *install-package-ruby-gems
264
+ - run: *install-dummy-app-ruby-gems
265
+ - run: *install-latest-chrome
266
+ - run:
267
+ name: Touch webpack bundles
268
+ command: touch spec/dummy/public/webpack/test/*
269
+ - run:
270
+ name: Install yalc globally
271
+ command: sudo yarn global add yalc
272
+ - run:
273
+ name: Prep for CI
274
+ # TODO -- need to leverage Circle CI containers
275
+ command: |
276
+ bundle exec rake prepare_for_ci
277
+ - run:
278
+ name: Main CI
279
+ # TODO -- need to leverage Circle CI containers
280
+ command: |
281
+ bundle exec rake run_rspec:all_dummy
282
+ # The following step will run only if the main job is finished successfully.
283
+ # Build hook is triggered by curl command described here https://docs.netlify.com/configure-builds/build-hooks/
284
+ # NETLIFY_HOOK is an environment variable on CircleCI to keep sensitive data outside the repo
285
+ - run:
286
+ name: Deploy SC website
287
+ command: |
288
+ if [ $CIRCLE_BRANCH = "master" ]; then
289
+ curl -X POST -d '{}' ${NETLIFY_HOOK}
290
+ fi
291
+ when: on_success
292
+ - store_test_results:
293
+ path: ~/rspec
294
+ - store_artifacts:
295
+ path: spec/dummy/tmp/capybara
296
+ - store_artifacts:
297
+ path: spec/dummy/tmp/screenshots
298
+ - store_artifacts:
299
+ path: spec/dummy/log/test.log
300
+ - store_artifacts:
301
+ path: spec/dummy/yarn-error.log
302
+
303
+ workflows:
304
+ version: 2
305
+ build-and-test:
306
+ jobs:
307
+ - install-package-node-packages
308
+ - install-package-ruby-gems
309
+ - install-dummy-app-node-packages
310
+ - install-dummy-app-ruby-gems
311
+ - lint-js-and-ruby:
312
+ requires:
313
+ - install-package-node-packages
314
+ - install-package-ruby-gems
315
+ - prettier:
316
+ filters:
317
+ branches:
318
+ ignore: master
319
+ requires:
320
+ - install-package-node-packages
321
+ - build-dummy-app-webpack-test-bundles:
322
+ requires:
323
+ - install-dummy-app-node-packages
324
+ - install-dummy-app-ruby-gems
325
+ - package-js-tests:
326
+ requires:
327
+ - install-package-node-packages
328
+ - rspec-package-specs:
329
+ requires:
330
+ - install-package-ruby-gems
331
+ - build-dummy-app-webpack-test-bundles
332
+ - install-dummy-app-ruby-gems
333
+ - main:
334
+ requires:
335
+ - install-package-ruby-gems
336
+ - install-dummy-app-ruby-gems
337
+ - install-package-node-packages
338
+ - build-dummy-app-webpack-test-bundles
data/.eslintignore CHANGED
@@ -2,7 +2,6 @@ node_modules
2
2
  coverage
3
3
  spec/react_on_rails/dummy-for-generators
4
4
  spec/dummy
5
- spec/dummy_no_webpacker
6
5
  node_package/lib/
7
6
  node_package/tests/node_modules
8
7
  node_package/webpack.config.js
@@ -14,3 +13,5 @@ node_package/webpack.config.js
14
13
  **/coverage/**
15
14
  **/cable.js
16
15
  **/public/packs*/*
16
+ gen-examples
17
+ bundle/
data/.eslintrc CHANGED
@@ -1,8 +1,10 @@
1
- ---
2
- extends: eslint-config-shakacode
1
+ extends:
2
+ - eslint-config-shakacode
3
+ - prettier
4
+ - prettier/react
3
5
 
4
6
  plugins:
5
- - react
7
+ - prettier
6
8
 
7
9
  globals:
8
10
  __DEBUG_SERVER_ERRORS__: true
@@ -12,9 +14,33 @@ env:
12
14
  browser: true
13
15
  node: true
14
16
  mocha: true
17
+ jest: true
18
+
19
+ overrides:
20
+ - files: ["**/*.ts", "**/*.tsx"]
21
+ parser: "@typescript-eslint/parser"
22
+ parserOptions:
23
+ ecmaVersion: 2018
24
+ sourceType: module
25
+ project: "./tsconfig.json"
26
+ extends:
27
+ - eslint:recommended
28
+ - plugin:@typescript-eslint/eslint-recommended
29
+ - plugin:@typescript-eslint/recommended
30
+ plugins:
31
+ - "@typescript-eslint"
32
+ rules:
33
+ "@typescript-eslint/no-namespace": 0
34
+ "@typescript-eslint/no-shadow": ["error"]
15
35
 
16
36
  rules:
37
+ no-shadow: 0
17
38
  no-console: 0
39
+ function-paren-newline: 0
40
+ object-curly-newline: 0
41
+ no-restricted-syntax: ["error", "SequenceExpression"]
42
+ # https://stackoverflow.com/a/59268871/5241481
43
+ import/extensions: ['error', 'ignorePackages', {"js": 'never',"ts": "never"}]
18
44
 
19
45
  # https://github.com/benmosher/eslint-plugin-import/issues/340
20
46
  import/no-extraneous-dependencies: 0
@@ -22,3 +48,6 @@ rules:
22
48
  settings:
23
49
  import/core-modules:
24
50
  - react-redux
51
+ import/resolver:
52
+ node:
53
+ extensions: [".js", ".ts", ".d.ts"]
@@ -0,0 +1 @@
1
+ github: [shakacode]
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open [a discussion](https://github.com/shakacode/react_on_rails/discussions).
11
+
12
+ ## Environment
13
+
14
+ 1. Ruby version:
15
+ 2. Rails version:
16
+ 3. Shakapacker/Webpacker version:
17
+ 4. React on Rails version:
18
+
19
+ ## Expected behavior
20
+
21
+ ## Actual behavior
22
+
23
+ ## Small, reproducible repo
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,19 @@
1
+ ### Summary
2
+
3
+ _Remove this paragraph and provide a general description of the code changes in your pull
4
+ request... were there any bugs you had fixed? If so, mention them. If
5
+ these bugs have open GitHub issues, be sure to tag them here as well,
6
+ to keep the conversation linked together._
7
+
8
+ ### Pull Request checklist
9
+ _Remove this line after checking all the items here. If the item is not applicable to the PR, both check it out and wrap it by `~`._
10
+
11
+ - [ ] Add/update test to cover these changes
12
+ - [ ] Update documentation
13
+ - [ ] Update CHANGELOG file
14
+ _Add the CHANGELOG entry at the top of the file._
15
+
16
+ ### Other Information
17
+
18
+ _Remove this paragraph and mention any other important and relevant information such as benchmarks._
19
+
@@ -0,0 +1,54 @@
1
+ name: Lint JS and Ruby
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.7]
10
+ node: [14]
11
+ runs-on: ubuntu-22.04
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Setup Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ bundler: 2.4.17
19
+ - name: Setup Node
20
+ uses: actions/setup-node@v2-beta
21
+ with:
22
+ node-version: ${{ matrix.node }}
23
+ - name: Print system information
24
+ run: |
25
+ echo "Linux release: "; cat /etc/issue
26
+ echo "Current user: "; whoami
27
+ echo "Current directory: "; pwd
28
+ echo "Ruby version: "; ruby -v
29
+ echo "Node version: "; node -v
30
+ echo "Yarn version: "; yarn --version
31
+ echo "Bundler version: "; bundle --version
32
+ - name: Save root node_modules to cache
33
+ uses: actions/cache@v2
34
+ with:
35
+ path: node_modules
36
+ key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
37
+ - name: Save root ruby gems to cache
38
+ uses: actions/cache@v2
39
+ with:
40
+ path: vendor/bundle
41
+ key: v5-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }}
42
+ - name: Install Node modules with Yarn for renderer package
43
+ run: |
44
+ yarn install --no-progress --no-emoji
45
+ yarn run eslint -v
46
+ sudo yarn global add yalc
47
+ - name: Install Ruby Gems for package
48
+ run: bundle check --path=vendor/bundle || bundle _2.4.17_ install --path=vendor/bundle --jobs=4 --retry=3
49
+ - name: Linting of Ruby
50
+ run: bundle exec rubocop
51
+ - name: Linting of JS
52
+ run: yarn start lint
53
+ - name: Check formatting
54
+ run: yarn start format.listDifferent