react_on_rails 11.1.4 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +320 -0
  3. data/.eslintignore +2 -1
  4. data/.eslintrc +30 -2
  5. data/.github/FUNDING.yml +1 -0
  6. data/.gitignore +3 -1
  7. data/.prettierignore +10 -0
  8. data/.prettierrc +23 -0
  9. data/.release-it.json +3 -0
  10. data/.rubocop.yml +37 -11
  11. data/.travis.yml +10 -20
  12. data/CHANGELOG.md +126 -4
  13. data/CONTRIBUTING.md +61 -80
  14. data/Gemfile +3 -5
  15. data/KUDOS.md +4 -1
  16. data/REACT-ON-RAILS-PRO-LICENSE +95 -0
  17. data/README.md +148 -89
  18. data/Rakefile +0 -7
  19. data/SUMMARY.md +12 -12
  20. data/book.json +5 -5
  21. data/docs/additional-reading/asset-pipeline.md +8 -16
  22. data/docs/additional-reading/images.md +1 -1
  23. data/docs/additional-reading/rails_view_rendering_from_inline_javascript.md +2 -1
  24. data/docs/additional-reading/react-helmet.md +30 -10
  25. data/docs/additional-reading/react-router.md +52 -75
  26. data/docs/additional-reading/server-rendering-tips.md +12 -7
  27. data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +10 -0
  28. data/docs/api/javascript-api.md +3 -3
  29. data/docs/api/redux-store-api.md +4 -2
  30. data/docs/api/view-helpers-api.md +17 -14
  31. data/docs/basics/client-vs-server-rendering.md +8 -2
  32. data/docs/basics/configuration.md +87 -73
  33. data/docs/basics/deployment.md +2 -4
  34. data/docs/basics/generator-details.md +1 -1
  35. data/docs/basics/heroku-deployment.md +24 -0
  36. data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +49 -0
  37. data/docs/basics/i18n.md +45 -23
  38. data/docs/basics/installation-into-an-existing-rails-app.md +4 -9
  39. data/docs/basics/minitest-configuration.md +31 -0
  40. data/docs/basics/react-server-rendering.md +3 -1
  41. data/docs/basics/recommended-project-structure.md +21 -15
  42. data/docs/basics/{generator-functions-and-railscontext.md → render-functions-and-railscontext.md} +59 -21
  43. data/docs/basics/rspec-configuration.md +29 -18
  44. data/docs/basics/upgrading-react-on-rails.md +74 -3
  45. data/docs/basics/webpack-configuration.md +29 -8
  46. data/docs/contributor-info/errors-with-hooks.md +45 -0
  47. data/docs/contributor-info/pull-requests.md +44 -0
  48. data/docs/misc/doctrine.md +1 -1
  49. data/docs/{misc-pending → outdated}/code-splitting.md +13 -9
  50. data/docs/{basics → outdated}/how-react-on-rails-works.md +8 -4
  51. data/docs/{misc-pending → outdated}/manual-installation-overview.md +5 -5
  52. data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
  53. data/docs/{misc-pending → outdated}/rails-assets.md +2 -12
  54. data/docs/testimonials/hvmn.md +25 -0
  55. data/docs/testimonials/resortpass.md +13 -0
  56. data/docs/testimonials/testimonials.md +28 -0
  57. data/docs/tutorial.md +182 -44
  58. data/jest.config.js +4 -0
  59. data/lib/generators/react_on_rails/base_generator.rb +2 -2
  60. data/lib/generators/react_on_rails/dev_tests_generator.rb +2 -1
  61. data/lib/generators/react_on_rails/generator_helper.rb +4 -6
  62. data/lib/generators/react_on_rails/install_generator.rb +2 -0
  63. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +3 -1
  64. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +26 -0
  65. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -40
  66. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +4 -1
  67. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +4 -8
  68. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
  69. data/lib/react_on_rails/configuration.rb +60 -29
  70. data/lib/react_on_rails/error.rb +2 -0
  71. data/lib/react_on_rails/git_utils.rb +2 -0
  72. data/lib/react_on_rails/helper.rb +110 -159
  73. data/lib/react_on_rails/json_output.rb +1 -1
  74. data/lib/react_on_rails/json_parse_error.rb +2 -0
  75. data/lib/react_on_rails/locales/base.rb +150 -0
  76. data/lib/react_on_rails/locales/to_js.rb +37 -0
  77. data/lib/react_on_rails/locales/to_json.rb +27 -0
  78. data/lib/react_on_rails/prerender_error.rb +11 -15
  79. data/lib/react_on_rails/react_component/render_options.rb +4 -0
  80. data/lib/react_on_rails/server_rendering_js_code.rb +42 -0
  81. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +85 -60
  82. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
  83. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +17 -0
  84. data/lib/react_on_rails/utils.rb +19 -20
  85. data/lib/react_on_rails/version.rb +1 -1
  86. data/lib/react_on_rails/version_checker.rb +5 -1
  87. data/lib/react_on_rails/webpacker_utils.rb +27 -2
  88. data/lib/react_on_rails.rb +4 -1
  89. data/lib/tasks/assets.rake +33 -46
  90. data/lib/tasks/locale.rake +4 -2
  91. data/package-scripts.yml +49 -0
  92. data/package.json +41 -31
  93. data/rakelib/dummy_apps.rake +1 -9
  94. data/rakelib/example_type.rb +3 -1
  95. data/rakelib/examples.rake +3 -0
  96. data/rakelib/lint.rake +2 -7
  97. data/rakelib/node_package.rake +2 -2
  98. data/rakelib/release.rake +3 -8
  99. data/rakelib/run_rspec.rake +5 -18
  100. data/react_on_rails.gemspec +4 -5
  101. data/tsconfig.json +14 -0
  102. data/webpackConfigLoader.js +5 -4
  103. data/yarn.lock +7177 -2311
  104. metadata +54 -55
  105. data/Gemfile.rails32 +0 -74
  106. data/docs/additional-reading/babel.md +0 -5
  107. data/docs/additional-reading/heroku-deployment.md +0 -92
  108. data/docs/additional-reading/hot-reloading-rails-development.md +0 -57
  109. data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
  110. data/docs/testimonials.md +0 -11
  111. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
  112. data/lib/react_on_rails/assets_precompile.rb +0 -150
  113. data/lib/react_on_rails/locales_to_js.rb +0 -134
  114. /data/docs/{misc → outdated}/rails3.md +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.4
4
+ version: 12.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-13 00:00:00.000000000 Z
11
+ date: 2020-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webpacker
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: awesome_print
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +114,14 @@ dependencies:
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1'
117
+ version: '2'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1'
124
+ version: '2'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: coveralls
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -220,20 +234,6 @@ dependencies:
220
234
  - - ">="
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0'
223
- - !ruby/object:Gem::Dependency
224
- name: pry-stack_explorer
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - ">="
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - ">="
235
- - !ruby/object:Gem::Version
236
- version: '0'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: pry-state
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +248,6 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
- - !ruby/object:Gem::Dependency
252
- name: pry-toys
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- version: '0'
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - ">="
263
- - !ruby/object:Gem::Version
264
- version: '0'
265
251
  - !ruby/object:Gem::Dependency
266
252
  name: rails
267
253
  requirement: !ruby/object:Gem::Requirement
@@ -308,16 +294,16 @@ dependencies:
308
294
  name: rubocop
309
295
  requirement: !ruby/object:Gem::Requirement
310
296
  requirements:
311
- - - "~>"
297
+ - - '='
312
298
  - !ruby/object:Gem::Version
313
- version: 0.58.1
299
+ version: 0.85.0
314
300
  type: :development
315
301
  prerelease: false
316
302
  version_requirements: !ruby/object:Gem::Requirement
317
303
  requirements:
318
- - - "~>"
304
+ - - '='
319
305
  - !ruby/object:Gem::Version
320
- version: 0.58.1
306
+ version: 0.85.0
321
307
  description: See README.md
322
308
  email:
323
309
  - justin@shakacode.com
@@ -326,12 +312,17 @@ extensions: []
326
312
  extra_rdoc_files: []
327
313
  files:
328
314
  - ".bookignore"
315
+ - ".circleci/config.yml"
329
316
  - ".coveralls.yml"
330
317
  - ".dockerignore"
331
318
  - ".eslintignore"
332
319
  - ".eslintrc"
320
+ - ".github/FUNDING.yml"
333
321
  - ".gitignore"
334
322
  - ".npmignore"
323
+ - ".prettierignore"
324
+ - ".prettierrc"
325
+ - ".release-it.json"
335
326
  - ".rspec"
336
327
  - ".rubocop.yml"
337
328
  - ".scss-lint.yml"
@@ -340,11 +331,11 @@ files:
340
331
  - CONTRIBUTING.md
341
332
  - Dockerfile_tests
342
333
  - Gemfile
343
- - Gemfile.rails32
344
334
  - KUDOS.md
345
335
  - LICENSE.md
346
336
  - NEWS.md
347
337
  - PROJECTS.md
338
+ - REACT-ON-RAILS-PRO-LICENSE
348
339
  - README.md
349
340
  - Rakefile
350
341
  - SUMMARY.md
@@ -353,17 +344,13 @@ files:
353
344
  - docker-compose.yml
354
345
  - docs/additional-reading/angular-js-integration-migration.md
355
346
  - docs/additional-reading/asset-pipeline.md
356
- - docs/additional-reading/babel.md
357
347
  - docs/additional-reading/capistrano-deployment.md
358
348
  - docs/additional-reading/convert-rails-5-api-only-app.md
359
349
  - docs/additional-reading/credits.md
360
350
  - docs/additional-reading/elastic-beanstalk.md
361
351
  - docs/additional-reading/foreman-issues.md
362
- - docs/additional-reading/heroku-deployment.md
363
- - docs/additional-reading/hot-reloading-rails-development.md
364
352
  - docs/additional-reading/images.md
365
353
  - docs/additional-reading/node-dependencies-and-npm.md
366
- - docs/additional-reading/rails-assets-relative-paths.md
367
354
  - docs/additional-reading/rails-engine-integration.md
368
355
  - docs/additional-reading/rails_view_rendering_from_inline_javascript.md
369
356
  - docs/additional-reading/react-and-redux.md
@@ -374,40 +361,49 @@ files:
374
361
  - docs/additional-reading/troubleshooting-when-using-webpacker.md
375
362
  - docs/additional-reading/turbolinks.md
376
363
  - docs/additional-reading/updating-dependencies.md
364
+ - docs/additional-reading/upgrade-webpacker-v3-to-v4.md
377
365
  - docs/additional-reading/webpack-dev-server.md
378
366
  - docs/additional-reading/webpack-v1-notes.md
379
367
  - docs/additional-reading/webpack.md
380
368
  - docs/api/javascript-api.md
381
369
  - docs/api/redux-store-api.md
382
- - docs/api/ruby-api-hot-reload-view-helpers.md
383
370
  - docs/api/view-helpers-api.md
384
371
  - docs/articles.md
385
372
  - docs/basics/client-vs-server-rendering.md
386
373
  - docs/basics/configuration.md
387
374
  - docs/basics/deployment.md
388
375
  - docs/basics/generator-details.md
389
- - docs/basics/generator-functions-and-railscontext.md
390
- - docs/basics/how-react-on-rails-works.md
376
+ - docs/basics/heroku-deployment.md
377
+ - docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md
391
378
  - docs/basics/i18n.md
392
379
  - docs/basics/installation-into-an-existing-rails-app.md
393
380
  - docs/basics/migrating-from-react-rails.md
381
+ - docs/basics/minitest-configuration.md
394
382
  - docs/basics/react-server-rendering.md
395
383
  - docs/basics/recommended-project-structure.md
384
+ - docs/basics/render-functions-and-railscontext.md
396
385
  - docs/basics/rspec-configuration.md
397
386
  - docs/basics/upgrading-react-on-rails.md
398
387
  - docs/basics/webpack-configuration.md
399
388
  - docs/coding-style/style.md
389
+ - docs/contributor-info/errors-with-hooks.md
400
390
  - docs/contributor-info/generator-testing.md
401
391
  - docs/contributor-info/linters.md
392
+ - docs/contributor-info/pull-requests.md
402
393
  - docs/contributor-info/releasing.md
403
- - docs/misc-pending/code-splitting.md
404
- - docs/misc-pending/manual-installation-overview.md
405
- - docs/misc-pending/rails-assets.md
406
394
  - docs/misc/code_of_conduct.md
407
395
  - docs/misc/doctrine.md
408
- - docs/misc/rails3.md
409
- - docs/testimonials.md
396
+ - docs/outdated/code-splitting.md
397
+ - docs/outdated/how-react-on-rails-works.md
398
+ - docs/outdated/manual-installation-overview.md
399
+ - docs/outdated/rails-assets-relative-paths.md
400
+ - docs/outdated/rails-assets.md
401
+ - docs/outdated/rails3.md
402
+ - docs/testimonials/hvmn.md
403
+ - docs/testimonials/resortpass.md
404
+ - docs/testimonials/testimonials.md
410
405
  - docs/tutorial.md
406
+ - jest.config.js
411
407
  - lib/generators/USAGE
412
408
  - lib/generators/react_on_rails/base_generator.rb
413
409
  - lib/generators/react_on_rails/dev_tests_generator.rb
@@ -418,7 +414,7 @@ files:
418
414
  - lib/generators/react_on_rails/react_with_redux_generator.rb
419
415
  - lib/generators/react_on_rails/templates/.eslintrc
420
416
  - lib/generators/react_on_rails/templates/base/base/Procfile.dev
421
- - lib/generators/react_on_rails/templates/base/base/Procfile.dev-server
417
+ - lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr
422
418
  - lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
423
419
  - lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx
424
420
  - lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt
@@ -439,7 +435,6 @@ files:
439
435
  - lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.jsx
440
436
  - lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js
441
437
  - lib/react_on_rails.rb
442
- - lib/react_on_rails/assets_precompile.rb
443
438
  - lib/react_on_rails/configuration.rb
444
439
  - lib/react_on_rails/controller.rb
445
440
  - lib/react_on_rails/engine.rb
@@ -448,9 +443,12 @@ files:
448
443
  - lib/react_on_rails/helper.rb
449
444
  - lib/react_on_rails/json_output.rb
450
445
  - lib/react_on_rails/json_parse_error.rb
451
- - lib/react_on_rails/locales_to_js.rb
446
+ - lib/react_on_rails/locales/base.rb
447
+ - lib/react_on_rails/locales/to_js.rb
448
+ - lib/react_on_rails/locales/to_json.rb
452
449
  - lib/react_on_rails/prerender_error.rb
453
450
  - lib/react_on_rails/react_component/render_options.rb
451
+ - lib/react_on_rails/server_rendering_js_code.rb
454
452
  - lib/react_on_rails/server_rendering_pool.rb
455
453
  - lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb
456
454
  - lib/react_on_rails/test_helper.rb
@@ -464,6 +462,7 @@ files:
464
462
  - lib/react_on_rails/webpacker_utils.rb
465
463
  - lib/tasks/assets.rake
466
464
  - lib/tasks/locale.rake
465
+ - package-scripts.yml
467
466
  - package.json
468
467
  - rakelib/docker.rake
469
468
  - rakelib/dummy_apps.rake
@@ -481,6 +480,7 @@ files:
481
480
  - script/release
482
481
  - script/setup
483
482
  - script/test
483
+ - tsconfig.json
484
484
  - webpackConfigLoader.js
485
485
  - yarn.lock
486
486
  homepage: https://github.com/shakacode/react_on_rails
@@ -500,15 +500,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
500
500
  requirements:
501
501
  - - ">="
502
502
  - !ruby/object:Gem::Version
503
- version: 2.1.0
503
+ version: 2.5.0
504
504
  required_rubygems_version: !ruby/object:Gem::Requirement
505
505
  requirements:
506
506
  - - ">="
507
507
  - !ruby/object:Gem::Version
508
508
  version: '0'
509
509
  requirements: []
510
- rubyforge_project:
511
- rubygems_version: 2.7.7
510
+ rubygems_version: 3.0.8
512
511
  signing_key:
513
512
  specification_version: 4
514
513
  summary: Rails with react server rendering with webpack.
data/Gemfile.rails32 DELETED
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- eval_gemfile File.expand_path("../react_on_rails.gemspec", __FILE__)
6
-
7
- # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
8
- gem "rails", "~> 3.2"
9
- # Use sqlite3 as the database for Active Record
10
- gem "sqlite3"
11
- # Use SCSS for stylesheets
12
- gem "sass-rails"
13
- # Use Uglifier as compressor for JavaScript assets
14
- gem "uglifier"
15
- # Use CoffeeScript for .coffee assets and views
16
- gem "coffee-rails"
17
-
18
- # Use jquery as the JavaScript library
19
- gem "jquery-rails"
20
-
21
- gem "puma"
22
-
23
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24
- gem "jbuilder"
25
- # bundle exec rake doc:rails generates the API under doc/api.
26
- gem "sdoc", group: :doc
27
-
28
- # Use ActiveModel has_secure_password
29
- # gem 'bcrypt', '~> 3.1.7'
30
-
31
- # Use Unicorn as the app server
32
- # gem 'unicorn'
33
-
34
- # Use Capistrano for deployment
35
- # gem 'capistrano-rails', group: :development
36
-
37
- gem "mini_racer"
38
- gem "connection_pool"
39
- gem "rainbow"
40
- gem "addressable"
41
- gem "execjs"
42
-
43
- group :development, :test do
44
- # Call 'byebug' anywhere in the code to stop execution and get a debugger console
45
- gem "awesome_print"
46
- gem "listen"
47
- gem "pry"
48
- gem "pry-byebug"
49
- gem "pry-doc"
50
- gem "pry-rails"
51
- gem "pry-rescue"
52
- gem "pry-stack_explorer"
53
- gem "rubocop", require: false
54
- gem "ruby-lint", require: false
55
- gem "scss_lint", require: false
56
-
57
- end
58
-
59
- group :test do
60
- gem "capybara"
61
- gem "capybara-screenshot"
62
- gem "coveralls", require: false
63
- # install trouble with updated
64
- # gem "capybara-webkit"
65
- gem "chromedriver-helper"
66
- gem "generator_spec"
67
- gem "launchy"
68
- gem "poltergeist"
69
- gem "rspec-rails"
70
- gem "rspec-retry"
71
- gem "selenium-webdriver"
72
- gem 'test-unit', '~> 3.0'
73
- gem "equivalent-xml", github: "mbklein/equivalent-xml"
74
- end
@@ -1,5 +0,0 @@
1
- # Babel
2
-
3
- As of React on Rails 2.0, we recommend Babel 6 and at least node version 5.5. If you want to stick with Babel 5 for a bit, see [Issue #238](https://github.com/shakacode/react_on_rails/issues/238).
4
-
5
- We recommend that you take a look at https://github.com/shakacode/react-webpack-rails-tutorial and follow the recipe there. We will try to keep that simple example updated.
@@ -1,92 +0,0 @@
1
- # Heroku Deployment
2
- The generator has created the necessary files and gems for deployment to Heroku. If you have installed manually, you will need to provide these files yourself:
3
-
4
- + `Procfile`: used by Heroku and Foreman to start the Puma server
5
- + `12factor` gem: required by Heroku if using a version before Rails 5 (see their [README](https://github.com/heroku/rails_12factor#rails-5) for more information if upgrading from a lower version)
6
- + `'puma'` gem: recommended Heroku webserver
7
- + `config/puma.rb`: Puma webserver config file
8
- + `/package.json`: Top level package.json which must contain `"scripts": { "postinstall": "cd client && npm install" }`
9
-
10
- If you want to see an updated example deployed to Heroku, please visit the [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial).
11
-
12
- ## More details on precompilation using webpack to create JavaScript assets
13
- This is how the `assets:precompile` rake task gets modified by `react_on_rails`. You should be able to call `clear_prerequisites` and setup your own custom precompile if needed.
14
- ```ruby
15
- # These tasks run as pre-requisites of assets:precompile.
16
- # Note, it's not possible to refer to ReactOnRails configuration values at this point.
17
- Rake::Task["assets:precompile"]
18
- .clear_prerequisites
19
- .enhance([:environment, "react_on_rails:assets:compile_environment"])
20
- .enhance do
21
- Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
22
- Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
23
- end
24
- ```
25
-
26
- For an example of how to do this, see the [dummy app](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/lib/tasks/assets.rake).
27
-
28
- ## Caching Node Modules
29
- By default Heroku will cache the root `node_modules` directory between deploys but since we're installing in `client/node_modules` you'll need to add the following line to the `package.json` in your root directory (otherwise you'll have to sit through a full `yarn` on each deploy):
30
-
31
- ```js
32
- "cacheDirectories": [
33
- "node_modules",
34
- "client/node_modules"
35
- ],
36
- ```
37
-
38
- ## How to Deploy
39
-
40
- React on Rails requires both a ruby environment (for Rails) and a Node environment (for Webpack), so you will need to have Heroku use multiple buildpacks.
41
-
42
- Assuming you have downloaded and installed the Heroku command-line utility and have initialized the app, you will need to tell Heroku to use both buildpacks via the command-line:
43
-
44
- ```
45
- heroku buildpacks:set heroku/ruby
46
- heroku buildpacks:add --index 1 heroku/nodejs
47
- ```
48
-
49
- For more information, see [Using Multiple Buildpacks for an App](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app)
50
-
51
- ## Fresh Rails Install
52
-
53
- ### Swap out sqlite for postgres by doing the following:
54
-
55
- #### 1. Delete the line with `sqlite` and replace it with:
56
-
57
- ```ruby
58
- gem 'pg'
59
- ```
60
-
61
- #### 2. Replace your `database.yml` file with this (assuming your app name is "ror")
62
-
63
- ```yml
64
- default: &default
65
- adapter: postgresql
66
- username:
67
- password:
68
- host: localhost
69
-
70
- development:
71
- <<: *default
72
- database: ror_development
73
-
74
- # Warning: The database defined as "test" will be erased and
75
- # re-generated from your development database when you run "rake".
76
- # Do not set this db to the same as development or production.
77
- test:
78
- <<: *default
79
- database: ror_test
80
-
81
- production:
82
- <<: *default
83
- database: ror_production
84
- ```
85
-
86
- Run:
87
-
88
- ```
89
- bundle
90
- bin/rake db:setup
91
- bin/rake db:migrate
92
- ```
@@ -1,57 +0,0 @@
1
- # Live Reloading vs. Hot Reloading (aka HMR)
2
-
3
- The use of the [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) provides "Live Reloading" by default. The difference between live and hot reloading is that live reloading will act similarly to hitting refresh in the browser. Hot reloading will attempt to preserve the state of any props.
4
-
5
- See the Webpack document [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/) for more details on the concepts of live vs. hot reloading.
6
-
7
- The remainder of this document discusses HMR.
8
-
9
- # Using the Webpacker Webpack setup
10
-
11
- If you are using the default Webpacker setup of running the dev server with `bin/webpack-dev-server`, see the [Webpacker Webpack Dev Server discussion of HMR](https://github.com/rails/webpacker/blob/master/docs/webpack-dev-server.md#hot-module-replacement).
12
-
13
-
14
- # Hot Reloading of Assets For Rails Development
15
-
16
- _Note, this document is not yet updated for React on Rails v8+. See [PR #865](https://github.com/shakacode/react_on_rails/pull/865) for a detailed example of doing hot reloading using V8+ with Webpack v2. Any volunteers to update this page? See [#772](https://github.com/shakacode/react_on_rails/issues/772) and [#361](https://github.com/shakacode/react-webpack-rails-tutorial/issues/361)._
17
-
18
- ------
19
-
20
- This document outlines the steps to setup your React On Rails Environment so that you can experience the pleasure of hot reloading of JavaScript and Sass during your Rails development work. See [Issue 332](https://github.com/shakacode/react_on_rails/issues/332) for troubleshooting. There are 3 examples of this setup:
21
-
22
- 1. [minimal demo here](https://github.com/retroalgic/react-on-rails-hot-minimal): The most simple and updated hot reloading setup.
23
- 1. [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy): Simpler setup used for integration testing this gem.
24
- 1. [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). Full featured setup using Twitter bootstrap.
25
-
26
- ## Help Wanted
27
-
28
- This doc might be outdated. PRs welcome!
29
-
30
- ## High Level Strategy
31
-
32
- We'll use a Webpack Dev server on port 3500 to provide the assets to Rails, rather than the asset pipeline, and only during development mode. This is configured via the `Procfile.hot`.
33
-
34
- `Procfile.static` provides an alternative that uses "static" assets, similar to a production deployment.
35
-
36
- ## Places to Configure (Files to Examine)
37
-
38
- 1. See the Webpack config files. Note, these examples are now setup for using [CSS Modules](https://github.com/css-modules/css-modules).
39
- 1. [client/webpack.client.base.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.base.config.js): Common configuration for hot or static assets.
40
- 1. [client/webpack.client.rails.hot.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.rails.hot.config.js): Setup for hot loading, using react-transform-hmr.
41
- 1. [client/webpack.client.rails.build.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.rails.build.config.js): Setup for static loading, as is done in a production deployment.
42
- 1. [app/views/layouts/application.html.erb](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/views/layouts/application.html.erb): Uses the view helpers `env_stylesheet_link_tag` and `env_javascript_include_tag` which will either do the hot reloading or the static loading.
43
- 1. See the Procfiles: [Procfile.hot](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/Procfile.hot) and [Procfile.static](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/Procfile.static). These:
44
- 1. Start the webpack processes, depending on the mode or HOT or not.
45
- 2. Start the rails server, setting an ENV value of REACT_ON_RAILS_ENV to HOT if we're hot loading or else setting this to blank.
46
- 1. Configure the file Rails asset pipeline files:
47
- 1. [app/assets/javascripts/application_static.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/assets/javascripts/application_static.js)
48
- 1. [app/assets/stylesheets/application_non_webpack.scss](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/app/assets/stylesheets/application_non_webpack.scss)
49
- 1. Copy the [client/server-rails-hot.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/server-rails-hot.js) to the your client directory.
50
- 1. Copy the scripts in the top level and client level `package.json` files:
51
- 1. Top Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/package.json)
52
- 1. Client Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/package.json)
53
-
54
-
55
- ## Code Snippets
56
- Please refer to the examples linked above in `spec/dummy` as these code samples might be out of date.
57
-
@@ -1,44 +0,0 @@
1
- ## NOTE: These helpers are NOT needed if using webpacker
2
-
3
- ## Hot Reloading View Helpers
4
- The `env_javascript_include_tag` and `env_stylesheet_link_tag` support the usage of a webpack dev server for providing the JS and CSS assets during development mode. See the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/) for a working example.
5
-
6
- The key options are `static` and `hot` which specify what you want for static vs. hot. Both of these params are optional, and support either a single value, or an array.
7
-
8
- static vs. hot is picked based on whether `ENV["REACT_ON_RAILS_ENV"] == "HOT"`
9
-
10
- ```erb
11
- <%= env_stylesheet_link_tag(static: 'application_static',
12
- hot: 'application_non_webpack',
13
- media: 'all',
14
- 'data-turbolinks-track' => true) %>
15
-
16
- <!-- These do not use turbolinks, so no data-turbolinks-track -->
17
- <!-- This is to load the hot assets. -->
18
-
19
- <!-- Note, you can have multiple files here. It's an array. -->
20
- <%= env_javascript_include_tag(hot: ['http://localhost:3500/hello-world-bundle.js]') %>
21
-
22
- <!-- These do use turbolinks -->
23
- <%= env_javascript_include_tag(static: 'application_static',
24
- hot: 'application_non_webpack',
25
- 'data-turbolinks-track' => true) %>
26
- ```
27
-
28
- See application.html.erb for usage example and [application.html.erb](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/app%2Fviews%2Flayouts%2Fapplication.html.erb)
29
-
30
- Helper to set CSS and JS assets depending on if we want static or "hot", which means from the Webpack dev server.
31
-
32
- In this example, `application_non_webpack` is simply a CSS asset pipeline file which includes styles not placed in the webpack build. The same can be said for `application_non_webpack` for JS files. Note, the suffix is not used in the helper calls.
33
-
34
- We don't need styles from the webpack build, as those will come via the JavaScript include tags.
35
-
36
- The key options are `static` and `hot` which specify what you want for static vs. hot. Both of
37
- these params are optional, and support either a single value, or an array.
38
-
39
- ```erb
40
- <%= env_stylesheet_link_tag(static: 'application_static',
41
- hot: 'application_non_webpack',
42
- media: 'all',
43
- 'data-turbolinks-track' => true) %>
44
- ```
data/docs/testimonials.md DELETED
@@ -1,11 +0,0 @@
1
- # Testimonials
2
-
3
- From Joel Hooks, Co-Founder, Chief Nerd at [egghead.io](https://egghead.io/), January 30, 2017:
4
-
5
- ![2017-01-30_11-33-59](https://cloud.githubusercontent.com/assets/1118459/22443635/b3549fb4-e6e3-11e6-8ea2-6f589dc93ed3.png)
6
-
7
- From Kyle Maune of Cooper Aerial, May 4, 2018
8
-
9
- ![image](https://user-images.githubusercontent.com/1118459/40891236-9b0b406e-671d-11e8-80ee-c026dbd1d5a2.png)
10
-
11
- For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](KUDOS.md).
@@ -1,12 +0,0 @@
1
- # You can run these commands in separate shells instead of using foreman
2
- web: rails s -p 3000
3
-
4
- # Next line runs the webpack-dev-server
5
- # You can edit config/webpacker.yml to set HMR to true to see hot reloading.
6
- # Note, hot and live reloading don't work with the default generator setup on top of
7
- # the rails/webpacker Webpack config with server rendering.
8
- # If you have server rendering enabled, modify the call to bin/webpack-dev-server line
9
- # so you add `--inline=false` and then CSS is not inlined.
10
- # Otherwise, you will have an error. If you want HMR and Server Rendering, see
11
- # the example in the https://github.com/shakacode/react-webpack-rails-tutorial
12
- client: sh -c 'rm -rf public/packs/* || true && bundle exec rake react_on_rails:locale && bin/webpack-dev-server'