react_on_rails 12.0.0.pre.beta.4 → 12.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint-js-and-ruby.yml +53 -0
  3. data/.github/workflows/main.yml +178 -0
  4. data/.github/workflows/package-js-tests.yml +35 -0
  5. data/.github/workflows/rspec-package-specs.yml +45 -0
  6. data/.rubocop.yml +1 -0
  7. data/.travis.yml +8 -4
  8. data/CHANGELOG.md +37 -20
  9. data/CONTRIBUTING.md +1 -1
  10. data/NEWS.md +5 -0
  11. data/README.md +65 -62
  12. data/SUMMARY.md +1 -1
  13. data/docs/additional-reading/converting-from-custom-webpack-config-to-rails-webpacker-config.md +10 -0
  14. data/docs/additional-reading/react-router.md +1 -1
  15. data/docs/additional-reading/recommended-project-structure.md +69 -0
  16. data/docs/additional-reading/server-rendering-tips.md +4 -1
  17. data/docs/api/javascript-api.md +3 -3
  18. data/docs/api/redux-store-api.md +2 -2
  19. data/docs/api/view-helpers-api.md +4 -4
  20. data/docs/basics/client-vs-server-rendering.md +2 -0
  21. data/docs/basics/configuration.md +1 -1
  22. data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +64 -9
  23. data/docs/basics/react-server-rendering.md +8 -5
  24. data/docs/basics/render-functions-and-railscontext.md +1 -1
  25. data/docs/basics/upgrading-react-on-rails.md +47 -10
  26. data/docs/basics/webpack-configuration.md +12 -18
  27. data/docs/misc/doctrine.md +0 -1
  28. data/docs/outdated/code-splitting.md +3 -3
  29. data/docs/tutorial.md +6 -0
  30. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +4 -1
  31. data/lib/react_on_rails/helper.rb +8 -8
  32. data/lib/react_on_rails/utils.rb +5 -1
  33. data/lib/react_on_rails/version.rb +1 -1
  34. data/lib/react_on_rails/webpacker_utils.rb +4 -4
  35. data/lib/tasks/assets.rake +17 -5
  36. data/package.json +1 -1
  37. data/rakelib/examples.rake +1 -1
  38. data/rakelib/lint.rake +1 -1
  39. data/rakelib/release.rake +1 -3
  40. metadata +10 -5
  41. data/docs/basics/recommended-project-structure.md +0 -77
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "12.0.0-beta.4",
3
+ "version": "12.0.3",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -6,7 +6,7 @@
6
6
  # Also see example_type.rb
7
7
 
8
8
  require "yaml"
9
- require 'rails/version'
9
+ require "rails/version"
10
10
 
11
11
  require_relative "example_type"
12
12
  require_relative "task_helpers"
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "task_helpers"
4
4
 
5
- namespace :lint do # rubocop:disable Metrics/BlockLength
5
+ namespace :lint do
6
6
  include ReactOnRails::TaskHelpers
7
7
 
8
8
  desc "Run Rubocop as shell"
@@ -67,8 +67,6 @@ task :release, %i[gem_version dry_run tools_install] do |_t, args|
67
67
  sh_in_dir(gem_root, release_it_command)
68
68
 
69
69
  # Release the new gem version
70
- unless is_dry_run
71
- sh_in_dir(gem_root, "gem release")
72
- end
70
+ sh_in_dir(gem_root, "gem release") unless is_dry_run
73
71
  end
74
72
  # rubocop:enable Metrics/BlockLength
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: 12.0.0.pre.beta.4
4
+ version: 12.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -318,6 +318,10 @@ files:
318
318
  - ".eslintignore"
319
319
  - ".eslintrc"
320
320
  - ".github/FUNDING.yml"
321
+ - ".github/workflows/lint-js-and-ruby.yml"
322
+ - ".github/workflows/main.yml"
323
+ - ".github/workflows/package-js-tests.yml"
324
+ - ".github/workflows/rspec-package-specs.yml"
321
325
  - ".gitignore"
322
326
  - ".npmignore"
323
327
  - ".prettierignore"
@@ -346,6 +350,7 @@ files:
346
350
  - docs/additional-reading/asset-pipeline.md
347
351
  - docs/additional-reading/capistrano-deployment.md
348
352
  - docs/additional-reading/convert-rails-5-api-only-app.md
353
+ - docs/additional-reading/converting-from-custom-webpack-config-to-rails-webpacker-config.md
349
354
  - docs/additional-reading/credits.md
350
355
  - docs/additional-reading/elastic-beanstalk.md
351
356
  - docs/additional-reading/foreman-issues.md
@@ -356,6 +361,7 @@ files:
356
361
  - docs/additional-reading/react-and-redux.md
357
362
  - docs/additional-reading/react-helmet.md
358
363
  - docs/additional-reading/react-router.md
364
+ - docs/additional-reading/recommended-project-structure.md
359
365
  - docs/additional-reading/server-rendering-tips.md
360
366
  - docs/additional-reading/tips.md
361
367
  - docs/additional-reading/troubleshooting-when-using-webpacker.md
@@ -380,7 +386,6 @@ files:
380
386
  - docs/basics/migrating-from-react-rails.md
381
387
  - docs/basics/minitest-configuration.md
382
388
  - docs/basics/react-server-rendering.md
383
- - docs/basics/recommended-project-structure.md
384
389
  - docs/basics/render-functions-and-railscontext.md
385
390
  - docs/basics/rspec-configuration.md
386
391
  - docs/basics/upgrading-react-on-rails.md
@@ -503,9 +508,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
503
508
  version: 2.5.0
504
509
  required_rubygems_version: !ruby/object:Gem::Requirement
505
510
  requirements:
506
- - - ">"
511
+ - - ">="
507
512
  - !ruby/object:Gem::Version
508
- version: 1.3.1
513
+ version: '0'
509
514
  requirements: []
510
515
  rubygems_version: 3.0.8
511
516
  signing_key:
@@ -1,77 +0,0 @@
1
- # Recommended Project structure
2
-
3
- The React on Rails generator uses the standard `rails/webpacker` convention of this structure:
4
-
5
- ```yml
6
- app/javascript:
7
- ├── bundles:
8
- │ # Logical groups of files that can be used for code splitting
9
- │ └── hello-world-bundle.js
10
- ├── packs:
11
- │ # only webpack entry files here
12
- │ └── hello-world-bundle.js
13
- ```
14
-
15
- However, you may wish to move all your client side files to a single directory called something like `/client`.
16
-
17
- ## Steps to convert from the generator defaults to use a `/client` directory structure.
18
-
19
- 1. Move the directory:
20
-
21
- ```
22
- mv app/javascript client
23
- ```
24
-
25
- 2. Edit your `/config/webpacker.yml` file. Change the `default/source_path`:
26
-
27
- ```yml
28
- source_path: client
29
- ```
30
-
31
- ## Moving node_modules from `/` to `/client` with a custom webpack setup.
32
-
33
- `rails/webpacker` probably doesn't support having your main node_modules directory under `/client`, so only follow these steps if you want to use your own webpack configuration.
34
-
35
- 1. Move the `/package.json` to `/client/package.json`
36
- 2. Create a `/package.json` that delegates to `/client/package.json`. See the example in [spec/dummy/package.json](../../spec/dummy/package.json).
37
- 3. See the webpack configuration in [spec/dummy/client](../../spec/dummy/client) for a webpack configuration example.
38
-
39
-
40
- ## JavaScript Assets
41
- 1. `/client`: All client side JavaScript goes under the `/client` directory. Place all the major domains of the client side app under client.
42
- 1. `/client/app`: All application JavaScript. Note the adherence to the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript#naming-conventions) where we name the files to correspond to exported Objects (PascalCase) or exported functions (camelCase). We don't use dashes or snake_case for JavaScript files, except for possibly some config files.
43
- 1. `/client/app/bundles`: Top level of different app domains. Use a name within this directory for you app domains. For example, if you had a domain called `widget-editing`, then you would have: `/client/app/bundles/widget-editing`
44
- 1. `/client/app/lib`: Common code for bundles
45
- 1. Within each bundle directory (or the lib directory), such as a domain named "comments"
46
- `/client/app/bundles/comments`, use following directory structure, if you're using redux. However, with React hooks, this will probably be a bit different:
47
-
48
- * `/actions`: Redux actions.
49
- * `/components`: "dumb" components (no connections to Redux or Ajax). These get props and can render themselves and children.
50
- * `/constants`: Constants used by Redux actions and reducers.
51
- * `/containers`: "smart" components. These components are bound to Redux.
52
- * `/reducers`: Reducers for redux.
53
- * `/routes`: Routes for React Router.
54
- * `/store`: Store, which might be [configured differently for dev vs. production](https://github.com/reactjs/redux/tree/master/examples/real-world/store).
55
- * `/startup`: Component bindings to stores, with registration of components and stores.
56
- * `/schemas`: Schemas for AJAX JSON requests and responses, as used by the [Normalizr](https://github.com/gaearon/normalizr) package.
57
-
58
- ## CSS, Sass, Fonts, and Images
59
- Should you move your styling assets to Webpack? Or stick with the plain Rails asset pipeline. It depends! You have 2 basic choices:
60
-
61
- ### Simple Rails Way
62
- This isn't really any technique, as you keep handling all your styling assets using Rails standard tools, such as using the [sass-rails gem](https://rubygems.org/gems/sass-rails/versions/5.0.4). Basically, Webpack doesn't get involved with styling. Your Rails layouts just doing the styling the standard Rails way.
63
-
64
- #### Advantages
65
- 1. Much simpler! There's no changes really from your current processes.
66
-
67
- ### Using Webpack to Manage Styling Assets
68
- This technique involves customization of the webpack config files to generate CSS, image, and font assets.
69
-
70
- #### Directory structure
71
- 1. `/client/app/assets`: Assets for CSS for client app.
72
- 1. `/client/app/assets/fonts` and `/client/app/assets/styles`: Globally shared assets for styling. Note, most Sass and image assets will be stored next to the JavaScript files.
73
-
74
- #### Advantages
75
- 1. You can use [CSS modules](https://github.com/css-modules/css-modules), which is super compelling once you seen the benefits.
76
- 1. You can do hot reloading of your assets. Thus, you do not have to refresh your web page to see asset change, including changing styles.
77
- 1. You can run your client code on a mocked out express server for super fast prototyping. In other words, your client application can somewhat more easily be move to a different application server.