react_on_rails 11.1.8 → 12.0.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) 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 +89 -3
  13. data/CONTRIBUTING.md +61 -80
  14. data/Gemfile +3 -5
  15. data/{COMM-LICENSE → REACT-ON-RAILS-PRO-LICENSE} +6 -9
  16. data/README.md +121 -71
  17. data/Rakefile +0 -7
  18. data/SUMMARY.md +10 -12
  19. data/book.json +5 -5
  20. data/docs/additional-reading/asset-pipeline.md +8 -16
  21. data/docs/additional-reading/images.md +1 -1
  22. data/docs/additional-reading/rails_view_rendering_from_inline_javascript.md +2 -1
  23. data/docs/additional-reading/react-helmet.md +30 -10
  24. data/docs/additional-reading/react-router.md +52 -75
  25. data/docs/additional-reading/server-rendering-tips.md +12 -7
  26. data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +10 -0
  27. data/docs/api/javascript-api.md +3 -3
  28. data/docs/api/redux-store-api.md +4 -2
  29. data/docs/api/view-helpers-api.md +17 -14
  30. data/docs/basics/configuration.md +64 -61
  31. data/docs/basics/deployment.md +1 -2
  32. data/docs/basics/i18n.md +44 -22
  33. data/docs/basics/installation-into-an-existing-rails-app.md +2 -2
  34. data/docs/basics/minitest-configuration.md +31 -0
  35. data/docs/basics/react-server-rendering.md +1 -1
  36. data/docs/basics/recommended-project-structure.md +1 -1
  37. data/docs/basics/{generator-functions-and-railscontext.md → render-functions-and-railscontext.md} +59 -21
  38. data/docs/basics/rspec-configuration.md +2 -2
  39. data/docs/basics/upgrading-react-on-rails.md +61 -3
  40. data/docs/basics/webpack-configuration.md +15 -1
  41. data/docs/contributor-info/errors-with-hooks.md +45 -0
  42. data/docs/contributor-info/pull-requests.md +44 -0
  43. data/docs/misc/doctrine.md +1 -1
  44. data/docs/{misc-pending → outdated}/code-splitting.md +13 -9
  45. data/docs/{additional-reading → outdated}/heroku-deployment.md +0 -6
  46. data/docs/{basics → outdated}/how-react-on-rails-works.md +3 -3
  47. data/docs/{misc-pending → outdated}/manual-installation-overview.md +5 -5
  48. data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
  49. data/docs/{misc-pending → outdated}/rails-assets.md +4 -7
  50. data/docs/{misc → outdated}/rails3.md +0 -0
  51. data/docs/testimonials/hvmn.md +3 -3
  52. data/docs/testimonials/resortpass.md +13 -0
  53. data/docs/testimonials/testimonials.md +11 -1
  54. data/docs/tutorial.md +69 -28
  55. data/jest.config.js +4 -0
  56. data/lib/generators/react_on_rails/base_generator.rb +2 -2
  57. data/lib/generators/react_on_rails/dev_tests_generator.rb +2 -1
  58. data/lib/generators/react_on_rails/generator_helper.rb +4 -6
  59. data/lib/generators/react_on_rails/install_generator.rb +2 -0
  60. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +3 -1
  61. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +18 -0
  62. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -40
  63. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +4 -8
  64. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
  65. data/lib/react_on_rails.rb +4 -1
  66. data/lib/react_on_rails/configuration.rb +15 -23
  67. data/lib/react_on_rails/error.rb +2 -0
  68. data/lib/react_on_rails/git_utils.rb +2 -0
  69. data/lib/react_on_rails/helper.rb +111 -162
  70. data/lib/react_on_rails/json_output.rb +1 -1
  71. data/lib/react_on_rails/json_parse_error.rb +2 -0
  72. data/lib/react_on_rails/locales/base.rb +142 -0
  73. data/lib/react_on_rails/locales/to_js.rb +37 -0
  74. data/lib/react_on_rails/locales/to_json.rb +27 -0
  75. data/lib/react_on_rails/prerender_error.rb +11 -15
  76. data/lib/react_on_rails/react_component/render_options.rb +4 -0
  77. data/lib/react_on_rails/server_rendering_js_code.rb +42 -0
  78. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +71 -51
  79. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
  80. data/lib/react_on_rails/utils.rb +15 -20
  81. data/lib/react_on_rails/version.rb +1 -1
  82. data/lib/react_on_rails/version_checker.rb +5 -1
  83. data/lib/react_on_rails/webpacker_utils.rb +16 -2
  84. data/lib/tasks/assets.rake +5 -45
  85. data/lib/tasks/locale.rake +8 -2
  86. data/package-scripts.yml +49 -0
  87. data/package.json +41 -31
  88. data/rakelib/dummy_apps.rake +1 -9
  89. data/rakelib/example_type.rb +3 -1
  90. data/rakelib/examples.rake +3 -0
  91. data/rakelib/lint.rake +2 -7
  92. data/rakelib/node_package.rake +2 -2
  93. data/rakelib/release.rake +3 -8
  94. data/rakelib/run_rspec.rake +5 -18
  95. data/react_on_rails.gemspec +3 -5
  96. data/tsconfig.json +14 -0
  97. data/webpackConfigLoader.js +5 -4
  98. data/yarn.lock +7042 -2327
  99. metadata +39 -57
  100. data/Gemfile.rails32 +0 -74
  101. data/docs/additional-reading/babel.md +0 -5
  102. data/docs/additional-reading/hot-reloading-rails-development-asset-pipeline.md +0 -47
  103. data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
  104. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
  105. data/lib/react_on_rails/assets_precompile.rb +0 -150
  106. data/lib/react_on_rails/locales_to_js.rb +0 -136
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.8
4
+ version: 12.0.0.pre.beta.1
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-10-14 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1'
103
+ version: '2'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1'
110
+ version: '2'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: coveralls
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -220,20 +220,6 @@ dependencies:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  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
223
  - !ruby/object:Gem::Dependency
238
224
  name: pry-state
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +234,6 @@ dependencies:
248
234
  - - ">="
249
235
  - !ruby/object:Gem::Version
250
236
  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
237
  - !ruby/object:Gem::Dependency
266
238
  name: rails
267
239
  requirement: !ruby/object:Gem::Requirement
@@ -308,16 +280,16 @@ dependencies:
308
280
  name: rubocop
309
281
  requirement: !ruby/object:Gem::Requirement
310
282
  requirements:
311
- - - "~>"
283
+ - - '='
312
284
  - !ruby/object:Gem::Version
313
- version: 0.58.1
285
+ version: 0.85.0
314
286
  type: :development
315
287
  prerelease: false
316
288
  version_requirements: !ruby/object:Gem::Requirement
317
289
  requirements:
318
- - - "~>"
290
+ - - '='
319
291
  - !ruby/object:Gem::Version
320
- version: 0.58.1
292
+ version: 0.85.0
321
293
  description: See README.md
322
294
  email:
323
295
  - justin@shakacode.com
@@ -326,26 +298,30 @@ extensions: []
326
298
  extra_rdoc_files: []
327
299
  files:
328
300
  - ".bookignore"
301
+ - ".circleci/config.yml"
329
302
  - ".coveralls.yml"
330
303
  - ".dockerignore"
331
304
  - ".eslintignore"
332
305
  - ".eslintrc"
306
+ - ".github/FUNDING.yml"
333
307
  - ".gitignore"
334
308
  - ".npmignore"
309
+ - ".prettierignore"
310
+ - ".prettierrc"
311
+ - ".release-it.json"
335
312
  - ".rspec"
336
313
  - ".rubocop.yml"
337
314
  - ".scss-lint.yml"
338
315
  - ".travis.yml"
339
316
  - CHANGELOG.md
340
- - COMM-LICENSE
341
317
  - CONTRIBUTING.md
342
318
  - Dockerfile_tests
343
319
  - Gemfile
344
- - Gemfile.rails32
345
320
  - KUDOS.md
346
321
  - LICENSE.md
347
322
  - NEWS.md
348
323
  - PROJECTS.md
324
+ - REACT-ON-RAILS-PRO-LICENSE
349
325
  - README.md
350
326
  - Rakefile
351
327
  - SUMMARY.md
@@ -354,17 +330,13 @@ files:
354
330
  - docker-compose.yml
355
331
  - docs/additional-reading/angular-js-integration-migration.md
356
332
  - docs/additional-reading/asset-pipeline.md
357
- - docs/additional-reading/babel.md
358
333
  - docs/additional-reading/capistrano-deployment.md
359
334
  - docs/additional-reading/convert-rails-5-api-only-app.md
360
335
  - docs/additional-reading/credits.md
361
336
  - docs/additional-reading/elastic-beanstalk.md
362
337
  - docs/additional-reading/foreman-issues.md
363
- - docs/additional-reading/heroku-deployment.md
364
- - docs/additional-reading/hot-reloading-rails-development-asset-pipeline.md
365
338
  - docs/additional-reading/images.md
366
339
  - docs/additional-reading/node-dependencies-and-npm.md
367
- - docs/additional-reading/rails-assets-relative-paths.md
368
340
  - docs/additional-reading/rails-engine-integration.md
369
341
  - docs/additional-reading/rails_view_rendering_from_inline_javascript.md
370
342
  - docs/additional-reading/react-and-redux.md
@@ -375,41 +347,48 @@ files:
375
347
  - docs/additional-reading/troubleshooting-when-using-webpacker.md
376
348
  - docs/additional-reading/turbolinks.md
377
349
  - docs/additional-reading/updating-dependencies.md
350
+ - docs/additional-reading/upgrade-webpacker-v3-to-v4.md
378
351
  - docs/additional-reading/webpack-dev-server.md
379
352
  - docs/additional-reading/webpack-v1-notes.md
380
353
  - docs/additional-reading/webpack.md
381
354
  - docs/api/javascript-api.md
382
355
  - docs/api/redux-store-api.md
383
- - docs/api/ruby-api-hot-reload-view-helpers.md
384
356
  - docs/api/view-helpers-api.md
385
357
  - docs/articles.md
386
358
  - docs/basics/client-vs-server-rendering.md
387
359
  - docs/basics/configuration.md
388
360
  - docs/basics/deployment.md
389
361
  - docs/basics/generator-details.md
390
- - docs/basics/generator-functions-and-railscontext.md
391
- - docs/basics/how-react-on-rails-works.md
392
362
  - docs/basics/i18n.md
393
363
  - docs/basics/installation-into-an-existing-rails-app.md
394
364
  - docs/basics/migrating-from-react-rails.md
365
+ - docs/basics/minitest-configuration.md
395
366
  - docs/basics/react-server-rendering.md
396
367
  - docs/basics/recommended-project-structure.md
368
+ - docs/basics/render-functions-and-railscontext.md
397
369
  - docs/basics/rspec-configuration.md
398
370
  - docs/basics/upgrading-react-on-rails.md
399
371
  - docs/basics/webpack-configuration.md
400
372
  - docs/coding-style/style.md
373
+ - docs/contributor-info/errors-with-hooks.md
401
374
  - docs/contributor-info/generator-testing.md
402
375
  - docs/contributor-info/linters.md
376
+ - docs/contributor-info/pull-requests.md
403
377
  - docs/contributor-info/releasing.md
404
- - docs/misc-pending/code-splitting.md
405
- - docs/misc-pending/manual-installation-overview.md
406
- - docs/misc-pending/rails-assets.md
407
378
  - docs/misc/code_of_conduct.md
408
379
  - docs/misc/doctrine.md
409
- - docs/misc/rails3.md
380
+ - docs/outdated/code-splitting.md
381
+ - docs/outdated/heroku-deployment.md
382
+ - docs/outdated/how-react-on-rails-works.md
383
+ - docs/outdated/manual-installation-overview.md
384
+ - docs/outdated/rails-assets-relative-paths.md
385
+ - docs/outdated/rails-assets.md
386
+ - docs/outdated/rails3.md
410
387
  - docs/testimonials/hvmn.md
388
+ - docs/testimonials/resortpass.md
411
389
  - docs/testimonials/testimonials.md
412
390
  - docs/tutorial.md
391
+ - jest.config.js
413
392
  - lib/generators/USAGE
414
393
  - lib/generators/react_on_rails/base_generator.rb
415
394
  - lib/generators/react_on_rails/dev_tests_generator.rb
@@ -420,7 +399,7 @@ files:
420
399
  - lib/generators/react_on_rails/react_with_redux_generator.rb
421
400
  - lib/generators/react_on_rails/templates/.eslintrc
422
401
  - lib/generators/react_on_rails/templates/base/base/Procfile.dev
423
- - lib/generators/react_on_rails/templates/base/base/Procfile.dev-server
402
+ - lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr
424
403
  - lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
425
404
  - lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx
426
405
  - lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt
@@ -441,7 +420,6 @@ files:
441
420
  - lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.jsx
442
421
  - lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js
443
422
  - lib/react_on_rails.rb
444
- - lib/react_on_rails/assets_precompile.rb
445
423
  - lib/react_on_rails/configuration.rb
446
424
  - lib/react_on_rails/controller.rb
447
425
  - lib/react_on_rails/engine.rb
@@ -450,9 +428,12 @@ files:
450
428
  - lib/react_on_rails/helper.rb
451
429
  - lib/react_on_rails/json_output.rb
452
430
  - lib/react_on_rails/json_parse_error.rb
453
- - lib/react_on_rails/locales_to_js.rb
431
+ - lib/react_on_rails/locales/base.rb
432
+ - lib/react_on_rails/locales/to_js.rb
433
+ - lib/react_on_rails/locales/to_json.rb
454
434
  - lib/react_on_rails/prerender_error.rb
455
435
  - lib/react_on_rails/react_component/render_options.rb
436
+ - lib/react_on_rails/server_rendering_js_code.rb
456
437
  - lib/react_on_rails/server_rendering_pool.rb
457
438
  - lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb
458
439
  - lib/react_on_rails/test_helper.rb
@@ -466,6 +447,7 @@ files:
466
447
  - lib/react_on_rails/webpacker_utils.rb
467
448
  - lib/tasks/assets.rake
468
449
  - lib/tasks/locale.rake
450
+ - package-scripts.yml
469
451
  - package.json
470
452
  - rakelib/docker.rake
471
453
  - rakelib/dummy_apps.rake
@@ -483,6 +465,7 @@ files:
483
465
  - script/release
484
466
  - script/setup
485
467
  - script/test
468
+ - tsconfig.json
486
469
  - webpackConfigLoader.js
487
470
  - yarn.lock
488
471
  homepage: https://github.com/shakacode/react_on_rails
@@ -502,15 +485,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
502
485
  requirements:
503
486
  - - ">="
504
487
  - !ruby/object:Gem::Version
505
- version: 2.1.0
488
+ version: 2.5.0
506
489
  required_rubygems_version: !ruby/object:Gem::Requirement
507
490
  requirements:
508
- - - ">="
491
+ - - ">"
509
492
  - !ruby/object:Gem::Version
510
- version: '0'
493
+ version: 1.3.1
511
494
  requirements: []
512
- rubyforge_project:
513
- rubygems_version: 2.7.7
495
+ rubygems_version: 3.0.8
514
496
  signing_key:
515
497
  specification_version: 4
516
498
  summary: Rails with react server rendering with webpack.
@@ -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,47 +0,0 @@
1
- *This document should only be referenced if you're **NOT** using the current technique of the rails/webpacker helpers to place your client-side assets in your `/public` directory.*
2
-
3
-
4
- # Hot Reloading of Assets For Rails Development
5
-
6
- _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. See [#772](https://github.com/shakacode/react_on_rails/issues/772) and [#361](https://github.com/shakacode/react-webpack-rails-tutorial/issues/361)._
7
-
8
- ------
9
-
10
- 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:
11
-
12
- 1. [minimal demo here](https://github.com/retroalgic/react-on-rails-hot-minimal): The most simple and updated hot reloading setup.
13
- 1. [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy): Simpler setup used for integration testing this gem.
14
- 1. [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). Full featured setup using Twitter bootstrap.
15
-
16
- ## Help Wanted
17
-
18
- This doc might be outdated. PRs welcome!
19
-
20
- ## High Level Strategy
21
-
22
- 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`.
23
-
24
- `Procfile.static` provides an alternative that uses "static" assets, similar to a production deployment.
25
-
26
- ## Places to Configure (Files to Examine)
27
-
28
- 1. See the Webpack config files. Note, these examples are now setup for using [CSS Modules](https://github.com/css-modules/css-modules).
29
- 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.
30
- 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.
31
- 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.
32
- 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.
33
- 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:
34
- 1. Start the webpack processes, depending on the mode or HOT or not.
35
- 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.
36
- 1. Configure the file Rails asset pipeline files:
37
- 1. [app/assets/javascripts/application_static.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/assets/javascripts/application_static.js)
38
- 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)
39
- 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.
40
- 1. Copy the scripts in the top level and client level `package.json` files:
41
- 1. Top Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/package.json)
42
- 1. Client Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/package.json)
43
-
44
-
45
- ## Code Snippets
46
- Please refer to the examples linked above in `spec/dummy` as these code samples might be out of date.
47
-
@@ -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
- ```
@@ -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'