react_on_rails 5.2.0 → 6.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +31 -0
  5. data/PROJECTS.md +11 -2
  6. data/README.md +33 -203
  7. data/app/helpers/react_on_rails_helper.rb +32 -49
  8. data/docs/additional-reading/heroku-deployment.md +2 -35
  9. data/docs/additional-reading/node-server-rendering.md +30 -0
  10. data/docs/additional-reading/rails-assets.md +19 -0
  11. data/docs/additional-reading/rspec-configuration.md +38 -4
  12. data/docs/additional-reading/webpack-dev-server.md +16 -0
  13. data/docs/additional-reading/webpack.md +0 -10
  14. data/docs/api/javascript-api.md +37 -0
  15. data/docs/api/ruby-api-hot-reload-view-helpers.md +42 -0
  16. data/docs/api/ruby-api.md +3 -0
  17. data/docs/basics/generator.md +49 -0
  18. data/docs/{additional-reading → basics}/installation-overview.md +0 -0
  19. data/docs/basics/migrating-from-react-rails.md +17 -0
  20. data/docs/contributor-info/contributing.md +11 -0
  21. data/docs/{coding-style → contributor-info}/linters.md +0 -0
  22. data/lib/generators/USAGE +3 -95
  23. data/lib/generators/react_on_rails/base_generator.rb +10 -43
  24. data/lib/generators/react_on_rails/dev_tests_generator.rb +17 -1
  25. data/lib/generators/react_on_rails/install_generator.rb +0 -6
  26. data/lib/generators/react_on_rails/react_no_redux_generator.rb +3 -17
  27. data/lib/generators/react_on_rails/react_with_redux_generator.rb +4 -21
  28. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +2 -2
  29. data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +3 -4
  30. data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx.tt +1 -11
  31. data/lib/generators/react_on_rails/templates/base/base/client/node/package.json +10 -0
  32. data/lib/generators/react_on_rails/templates/base/base/client/node/server.js +82 -0
  33. data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +3 -20
  34. data/lib/generators/react_on_rails/templates/base/base/client/webpack.config.js +58 -0
  35. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +60 -26
  36. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt +1 -4
  37. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/load_test.rake +8 -0
  38. data/lib/generators/react_on_rails/templates/base/base/package.json.tt +0 -12
  39. data/lib/generators/react_on_rails/templates/dev_tests/spec/features/hello_world_spec.rb +1 -1
  40. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +1 -0
  41. data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +1 -7
  42. data/lib/generators/react_on_rails/templates/{base/base/client/app/bundles/HelloWorld/startup/clientRegistration.jsx.tt → no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx.tt} +7 -1
  43. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/{HelloWorldAppClient.jsx.tt → HelloWorldApp.jsx.tt} +5 -1
  44. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +1 -5
  45. data/lib/react_on_rails.rb +2 -1
  46. data/lib/react_on_rails/configuration.rb +17 -5
  47. data/lib/react_on_rails/react_component/options.rb +76 -0
  48. data/lib/react_on_rails/server_rendering_pool.rb +9 -151
  49. data/lib/react_on_rails/server_rendering_pool/exec.rb +166 -0
  50. data/lib/react_on_rails/server_rendering_pool/node.rb +77 -0
  51. data/lib/react_on_rails/test_helper.rb +1 -6
  52. data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +4 -77
  53. data/lib/react_on_rails/test_helper/node_process_launcher.rb +12 -0
  54. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +4 -28
  55. data/lib/react_on_rails/version.rb +1 -1
  56. data/lib/tasks/assets.rake +115 -0
  57. data/package.json +2 -1
  58. data/rakelib/example_type.rb +3 -10
  59. data/rakelib/examples_config.yml +2 -2
  60. data/react_on_rails.gemspec +1 -0
  61. metadata +41 -20
  62. data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +0 -16
  63. data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +0 -3
  64. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js +0 -65
  65. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +0 -53
  66. data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverRegistration.jsx +0 -4
  67. data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +0 -39
  68. data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +0 -6
  69. data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -6
  70. data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +0 -21
  71. data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -19
  72. data/lib/react_on_rails/test_helper/webpack_process_checker.rb +0 -54
@@ -4,11 +4,11 @@ example_type_data:
4
4
  generator_options: ""
5
5
  -
6
6
  name: basic-server-rendering
7
- generator_options: --server-rendering
7
+ generator_options: --example-server-rendering
8
8
  -
9
9
  name: redux
10
10
  generator_options: --redux
11
11
  -
12
12
  name: redux-server-rendering
13
- generator_options: --redux --server-rendering
13
+ generator_options: --redux --example-server-rendering
14
14
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency "rainbow", "~> 2.1"
25
25
  s.add_dependency "rails", ">= 3.2"
26
26
  s.add_dependency "foreman"
27
+ s.add_dependency "addressable"
27
28
 
28
29
  s.add_development_dependency "bundler", "~> 1.10"
29
30
  s.add_development_dependency "rake", "~> 10.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: 5.2.0
4
+ version: 6.0.0.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: 2016-04-09 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: addressable
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -322,8 +336,9 @@ files:
322
336
  - docs/additional-reading/babel.md
323
337
  - docs/additional-reading/heroku-deployment.md
324
338
  - docs/additional-reading/hot-reloading-rails-development.md
325
- - docs/additional-reading/installation-overview.md
326
339
  - docs/additional-reading/node-dependencies-and-npm.md
340
+ - docs/additional-reading/node-server-rendering.md
341
+ - docs/additional-reading/rails-assets.md
327
342
  - docs/additional-reading/rails_view_rendering_from_inline_javascript.md
328
343
  - docs/additional-reading/react-and-redux.md
329
344
  - docs/additional-reading/react-router.md
@@ -333,11 +348,18 @@ files:
333
348
  - docs/additional-reading/tips.md
334
349
  - docs/additional-reading/turbolinks.md
335
350
  - docs/additional-reading/updating-dependencies.md
351
+ - docs/additional-reading/webpack-dev-server.md
336
352
  - docs/additional-reading/webpack.md
337
- - docs/coding-style/linters.md
353
+ - docs/api/javascript-api.md
354
+ - docs/api/ruby-api-hot-reload-view-helpers.md
355
+ - docs/api/ruby-api.md
356
+ - docs/basics/generator.md
357
+ - docs/basics/installation-overview.md
358
+ - docs/basics/migrating-from-react-rails.md
338
359
  - docs/coding-style/style.md
339
360
  - docs/contributor-info/contributing.md
340
361
  - docs/contributor-info/generator-testing.md
362
+ - docs/contributor-info/linters.md
341
363
  - docs/contributor-info/releasing.md
342
364
  - docs/misc/code_of_conduct.md
343
365
  - docs/misc/doctrine.md
@@ -351,55 +373,54 @@ files:
351
373
  - lib/generators/react_on_rails/install_generator.rb
352
374
  - lib/generators/react_on_rails/react_no_redux_generator.rb
353
375
  - lib/generators/react_on_rails/react_with_redux_generator.rb
376
+ - lib/generators/react_on_rails/templates/base/base/.DS_Store
354
377
  - lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt
355
- - lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md
356
378
  - lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
357
379
  - lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt
358
380
  - lib/generators/react_on_rails/templates/base/base/client/.babelrc
359
- - lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md
360
381
  - lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx.tt
361
- - lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/clientRegistration.jsx.tt
382
+ - lib/generators/react_on_rails/templates/base/base/client/node/package.json
383
+ - lib/generators/react_on_rails/templates/base/base/client/node/server.js
362
384
  - lib/generators/react_on_rails/templates/base/base/client/package.json.tt
363
- - lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js
364
- - lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js
385
+ - lib/generators/react_on_rails/templates/base/base/client/webpack.config.js
365
386
  - lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt
366
387
  - lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt
388
+ - lib/generators/react_on_rails/templates/base/base/lib/tasks/load_test.rake
367
389
  - lib/generators/react_on_rails/templates/base/base/package.json.tt
368
- - lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverRegistration.jsx
369
- - lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js
370
390
  - lib/generators/react_on_rails/templates/dev_tests/.rspec
371
391
  - lib/generators/react_on_rails/templates/dev_tests/spec/features/hello_world_spec.rb
372
392
  - lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb
373
393
  - lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb
374
394
  - lib/generators/react_on_rails/templates/dev_tests/spec/spec_helper.rb
375
395
  - lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx
376
- - lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt
377
- - lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx
396
+ - lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx.tt
378
397
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
379
398
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx
380
399
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx
381
400
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx
382
401
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx
383
- - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt
402
+ - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx.tt
384
403
  - lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx
385
- - lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js
386
- - lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx
387
404
  - lib/react_on_rails.rb
388
405
  - lib/react_on_rails/configuration.rb
389
406
  - lib/react_on_rails/controller.rb
390
407
  - lib/react_on_rails/engine.rb
391
408
  - lib/react_on_rails/git_utils.rb
392
409
  - lib/react_on_rails/prerender_error.rb
410
+ - lib/react_on_rails/react_component/options.rb
393
411
  - lib/react_on_rails/server_rendering_pool.rb
412
+ - lib/react_on_rails/server_rendering_pool/exec.rb
413
+ - lib/react_on_rails/server_rendering_pool/node.rb
394
414
  - lib/react_on_rails/test_helper.rb
395
415
  - lib/react_on_rails/test_helper/ensure_assets_compiled.rb
416
+ - lib/react_on_rails/test_helper/node_process_launcher.rb
396
417
  - lib/react_on_rails/test_helper/webpack_assets_compiler.rb
397
418
  - lib/react_on_rails/test_helper/webpack_assets_status_checker.rb
398
- - lib/react_on_rails/test_helper/webpack_process_checker.rb
399
419
  - lib/react_on_rails/utils.rb
400
420
  - lib/react_on_rails/version.rb
401
421
  - lib/react_on_rails/version_checker.rb
402
422
  - lib/react_on_rails/version_syntax_converter.rb
423
+ - lib/tasks/assets.rake
403
424
  - npm-shrinkwrap.json
404
425
  - package.json
405
426
  - rakelib/docker.rake
@@ -433,12 +454,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
433
454
  version: '0'
434
455
  required_rubygems_version: !ruby/object:Gem::Requirement
435
456
  requirements:
436
- - - ">="
457
+ - - ">"
437
458
  - !ruby/object:Gem::Version
438
- version: '0'
459
+ version: 1.3.1
439
460
  requirements: []
440
461
  rubyforge_project:
441
- rubygems_version: 2.6.1
462
+ rubygems_version: 2.5.1
442
463
  signing_key:
443
464
  specification_version: 4
444
465
  summary: Rails with react server rendering with webpack.
@@ -1,16 +0,0 @@
1
- The `react_on_rails` gem has been installed. You can view the documentation online at
2
- [React on Rails](https://github.com/shakacode/react_on_rails).
3
-
4
- Also, check out the [example application](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/client/server.js)
5
- for a live example and code.
6
-
7
- The "Hello World" example has been installed.
8
-
9
- + The view is located at `app/views/hello_world/index.html.erb`
10
- + The controller is located at `app/controllers/hello_world_controller.rb`
11
-
12
- See [the documentation](https://github.com/shakacode/react_on_rails) for how to build your bundles and
13
- install your packages. Then you can view the example as follows:
14
-
15
- - Rails Server: [localhost:3000/hello_world](http://localhost:3000/hello_world)
16
- - Webpack Development Server with HMR: [localhost:4000/hello_world](http://localhost:4000/hello_world)
@@ -1,3 +0,0 @@
1
- Client folder generated by React on Rails gem.
2
-
3
- See documentation [on github](https://github.com/shakacode/react_on_rails) for details on how it is organized.
@@ -1,65 +0,0 @@
1
- // Common client-side webpack configuration used by webpack.hot.config and webpack.rails.config.
2
-
3
- const webpack = require('webpack');
4
- const path = require('path');
5
-
6
- const devBuild = process.env.NODE_ENV !== 'production';
7
- const nodeEnv = devBuild ? 'development' : 'production';
8
-
9
- module.exports = {
10
-
11
- // the project dir
12
- context: __dirname,
13
- entry: {
14
-
15
- // See use of 'vendor' in the CommonsChunkPlugin inclusion below.
16
- vendor: [
17
- 'babel-polyfill',
18
- 'jquery',
19
- ],
20
-
21
- // This will contain the app entry points defined by webpack.hot.config and
22
- // webpack.rails.config
23
- app: [
24
- './app/bundles/HelloWorld/startup/clientRegistration',
25
- ],
26
- },
27
- resolve: {
28
- extensions: ['', '.js', '.jsx'],
29
- alias: {
30
- lib: path.join(process.cwd(), 'app', 'lib'),
31
- react: path.resolve('./node_modules/react'),
32
- 'react-dom': path.resolve('./node_modules/react-dom'),
33
- },
34
- },
35
- plugins: [
36
- new webpack.DefinePlugin({
37
- 'process.env': {
38
- NODE_ENV: JSON.stringify(nodeEnv),
39
- },
40
- }),
41
-
42
- // https://webpack.github.io/docs/list-of-plugins.html#2-explicit-vendor-chunk
43
- new webpack.optimize.CommonsChunkPlugin({
44
-
45
- // This name 'vendor' ties into the entry definition
46
- name: 'vendor',
47
-
48
- // We don't want the default vendor.js name
49
- filename: 'vendor-bundle.js',
50
-
51
- // Passing Infinity just creates the commons chunk, but moves no modules into it.
52
- // In other words, we only put what's in the vendor entry definition in vendor-bundle.js
53
- minChunks: Infinity,
54
- }),
55
- ],
56
- module: {
57
- loaders: [
58
-
59
- // Not all apps require jQuery. Many Rails apps do, such as those using TurboLinks or
60
- // bootstrap js
61
- { test: require.resolve('jquery'), loader: 'expose?jQuery' },
62
- { test: require.resolve('jquery'), loader: 'expose?$' },
63
- ],
64
- },
65
- };
@@ -1,53 +0,0 @@
1
- // Run like this:
2
- // cd client && npm run build:dev:client
3
- // Note that Foreman (Procfile.dev) has also been configured to take care of this.
4
-
5
- // NOTE: All style sheets handled by the asset pipeline in rails
6
-
7
- const webpack = require('webpack');
8
- const config = require('./webpack.client.base.config');
9
- const devBuild = process.env.NODE_ENV !== 'production';
10
-
11
- config.output = {
12
- filename: '[name]-bundle.js',
13
- path: '../app/assets/webpack',
14
- };
15
-
16
- // You can add entry points specific to rails here
17
- // The es5-shim/sham is for capybara testing
18
- config.entry.vendor.unshift(
19
- 'es5-shim/es5-shim',
20
- 'es5-shim/es5-sham'
21
- );
22
-
23
- // jquery-ujs MUST GO AFTER jquery, so must use 'push'
24
- config.entry.vendor.push('jquery-ujs');
25
-
26
- // See webpack.common.config for adding modules common to both the webpack dev server and rails
27
- config.module.loaders.push(
28
- {
29
- test: /\.jsx?$/,
30
- loader: 'babel-loader',
31
- exclude: /node_modules/,
32
- },
33
- {
34
- test: require.resolve('react'),
35
- loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham',
36
- },
37
- {
38
- test: require.resolve('jquery-ujs'),
39
- loader: 'imports?jQuery=jquery',
40
- }
41
- );
42
-
43
- module.exports = config;
44
-
45
- if (devBuild) {
46
- console.log('Webpack dev build for Rails'); // eslint-disable-line no-console
47
- module.exports.devtool = 'eval-source-map';
48
- } else {
49
- config.plugins.push(
50
- new webpack.optimize.DedupePlugin()
51
- );
52
- console.log('Webpack production build for Rails'); // eslint-disable-line no-console
53
- }
@@ -1,4 +0,0 @@
1
- import ReactOnRails from 'react-on-rails';
2
- import HelloWorldApp from './HelloWorldAppServer';
3
-
4
- ReactOnRails.register({ HelloWorldApp });
@@ -1,39 +0,0 @@
1
- // Webpack configuration for server bundle
2
-
3
- const webpack = require('webpack');
4
- const path = require('path');
5
-
6
- const devBuild = process.env.NODE_ENV !== 'production';
7
- const nodeEnv = devBuild ? 'development' : 'production';
8
-
9
- module.exports = {
10
-
11
- // the project dir
12
- context: __dirname,
13
- entry: [
14
- 'babel-polyfill',
15
- './app/bundles/HelloWorld/startup/serverRegistration',
16
- ],
17
- output: {
18
- filename: 'server-bundle.js',
19
- path: '../app/assets/webpack',
20
- },
21
- resolve: {
22
- extensions: ['', '.js', '.jsx'],
23
- alias: {
24
- lib: path.join(process.cwd(), 'app', 'lib'),
25
- },
26
- },
27
- plugins: [
28
- new webpack.DefinePlugin({
29
- 'process.env': {
30
- NODE_ENV: JSON.stringify(nodeEnv),
31
- },
32
- }),
33
- ],
34
- module: {
35
- loaders: [
36
- { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
37
- ],
38
- },
39
- };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import HelloWorld from '../containers/HelloWorld';
3
-
4
- export default (props) => (
5
- <HelloWorld {...props} />
6
- );
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import HelloWorld from '../containers/HelloWorld';
3
-
4
- export default (props) => (
5
- <HelloWorld {...props} />
6
- );
@@ -1,21 +0,0 @@
1
- /* eslint no-console: 0 */
2
-
3
- // This logger should be configured not to run in a production environment.
4
- // See https://github.com/petehunt/webpack-howto#6-feature-flags for how you might turn this
5
- // off for production.
6
- export default function logger({ getState }) {
7
- return next => action => {
8
- console.log('will dispatch', action);
9
-
10
- // Call the next dispatch method in the middleware chain.
11
- const result = next(action);
12
-
13
- const immutableState = getState();
14
-
15
- console.log('state after dispatch', JSON.stringify(immutableState));
16
-
17
- // This will likely be the action itself, unless
18
- // a middleware further in chain changed it.
19
- return result;
20
- };
21
- }
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { Provider } from 'react-redux';
3
-
4
- import createStore from '../store/helloWorldStore';
5
- import HelloWorld from '../containers/HelloWorld';
6
-
7
- // See documentation for https://github.com/reactjs/react-redux.
8
- // This is how you get props from the Rails view into the redux store.
9
- // This code here binds your smart component to the redux store.
10
- // This is how the server redux gets hydrated with data.
11
- export default (props) => {
12
- const store = createStore(props);
13
- const reactComponent = (
14
- <Provider store={store}>
15
- <HelloWorld />
16
- </Provider>
17
- );
18
- return reactComponent;
19
- };
@@ -1,54 +0,0 @@
1
- # You can replace this implementation with your own for use by the
2
- # ReactOnRails::TestHelper.ensure_assets_compiled helper
3
- module ReactOnRails
4
- module TestHelper
5
- class WebpackProcessChecker
6
- def initialize
7
- @printed_once = {}
8
- @needs_client_compile = true
9
- @needs_server_compile = Utils.server_rendering_is_enabled?
10
- @wait_longer = false
11
- end
12
-
13
- # Return true if we should keep waiting
14
- # type is either client or server
15
- def client_running?
16
- client_running = check_running_for_type("client")
17
- return false unless client_running
18
- end
19
-
20
- def server_running?
21
- if Utils.server_rendering_is_enabled?
22
- return true if check_running_for_type("server")
23
- end
24
- false
25
- end
26
-
27
- def hot_running?
28
- _response = `pgrep -fl 'babel-node +server-rails-hot.js'`
29
- Utils.last_process_completed_successfully?
30
- end
31
-
32
- private
33
-
34
- def check_running_for_type(type)
35
- type = type.to_sym
36
-
37
- response = `pgrep -fl 'bin/webpack\s(\\-w|\\-\\-watch)\s\\-\\-config\s.*#{type}.*\\.js'`
38
- is_running = Utils.last_process_completed_successfully?
39
-
40
- if is_running
41
- if @printed_once.empty?
42
- puts "\nDetected Webpack processes running to rebuild your generated files:"
43
- end
44
- unless @printed_once[type]
45
- puts "#{type}: #{response}"
46
- @printed_once[type] = true
47
- end
48
- end
49
-
50
- is_running
51
- end
52
- end
53
- end
54
- end