react_on_rails 12.0.1 → 12.1.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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -2
  3. data/.eslintrc +2 -1
  4. data/.github/workflows/lint-js-and-ruby.yml +53 -0
  5. data/.github/workflows/main.yml +178 -0
  6. data/.github/workflows/package-js-tests.yml +35 -0
  7. data/.github/workflows/rspec-package-specs.yml +45 -0
  8. data/.prettierrc +0 -3
  9. data/.rubocop.yml +46 -38
  10. data/.travis.yml +3 -1
  11. data/CHANGELOG.md +39 -11
  12. data/CONTRIBUTING.md +4 -3
  13. data/Gemfile +1 -33
  14. data/Gemfile.development_dependencies +51 -0
  15. data/NEWS.md +5 -0
  16. data/README.md +66 -57
  17. data/SUMMARY.md +1 -1
  18. data/docs/{basics → additional-details}/generator-details.md +1 -6
  19. data/docs/{outdated → additional-details}/manual-installation-overview.md +6 -6
  20. data/docs/additional-details/recommended-project-structure.md +69 -0
  21. data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +10 -0
  22. data/docs/api/javascript-api.md +2 -2
  23. data/docs/api/redux-store-api.md +3 -3
  24. data/docs/api/view-helpers-api.md +7 -8
  25. data/docs/basics/client-vs-server-rendering.md +4 -2
  26. data/docs/basics/configuration.md +42 -25
  27. data/docs/basics/deployment.md +2 -2
  28. data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +64 -9
  29. data/docs/{outdated → basics}/how-react-on-rails-works.md +8 -9
  30. data/docs/basics/installation-into-an-existing-rails-app.md +13 -6
  31. data/docs/basics/react-server-rendering.md +8 -5
  32. data/docs/basics/rspec-configuration.md +10 -10
  33. data/docs/{tutorial.md → basics/tutorial.md} +28 -30
  34. data/docs/basics/upgrading-react-on-rails.md +41 -18
  35. data/docs/basics/webpack-configuration.md +14 -22
  36. data/docs/contributor-info/linters.md +5 -6
  37. data/docs/contributor-info/pull-requests.md +2 -4
  38. data/docs/contributor-info/releasing.md +1 -1
  39. data/docs/home.md +382 -0
  40. data/docs/{outdated → javascript}/code-splitting.md +5 -5
  41. data/docs/{additional-reading → javascript}/converting-from-custom-webpack-config-to-rails-webpacker-config.md +3 -3
  42. data/docs/{additional-reading → javascript}/images.md +5 -6
  43. data/docs/{articles.md → misc/articles.md} +1 -1
  44. data/docs/misc/doctrine.md +5 -6
  45. data/docs/outdated/deferred-rendering.md +39 -0
  46. data/docs/outdated/rails-assets-relative-paths.md +3 -3
  47. data/docs/outdated/rails-assets.md +8 -8
  48. data/docs/outdated/rails3.md +2 -2
  49. data/docs/{additional-reading → rails}/convert-rails-5-api-only-app.md +1 -1
  50. data/docs/rails-webpacker-react-integration-options.md +182 -0
  51. data/docs/testimonials/testimonials.md +6 -6
  52. data/lib/generators/react_on_rails/base_generator.rb +8 -1
  53. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
  54. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +8 -2
  55. data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +1 -1
  56. data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb +2 -2
  57. data/lib/react_on_rails/configuration.rb +2 -0
  58. data/lib/react_on_rails/git_utils.rb +3 -3
  59. data/lib/react_on_rails/helper.rb +15 -9
  60. data/lib/react_on_rails/locales/base.rb +3 -3
  61. data/lib/react_on_rails/locales/to_js.rb +0 -4
  62. data/lib/react_on_rails/locales/to_json.rb +0 -4
  63. data/lib/react_on_rails/prerender_error.rb +1 -1
  64. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +6 -6
  65. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +1 -1
  66. data/lib/react_on_rails/test_helper.rb +2 -0
  67. data/lib/react_on_rails/utils.rb +24 -4
  68. data/lib/react_on_rails/version.rb +1 -1
  69. data/lib/react_on_rails/webpacker_utils.rb +9 -5
  70. data/lib/tasks/assets.rake +20 -11
  71. data/package.json +24 -29
  72. data/rakelib/docker.rake +0 -5
  73. data/rakelib/lint.rake +3 -9
  74. data/rakelib/release.rake +27 -13
  75. data/rakelib/run_rspec.rake +10 -11
  76. data/rakelib/task_helpers.rb +16 -4
  77. data/react_on_rails.gemspec +3 -17
  78. data/yarn.lock +2272 -4960
  79. metadata +50 -225
  80. data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +0 -10
  81. data/docs/additional-reading/webpack-dev-server.md +0 -15
  82. data/docs/basics/recommended-project-structure.md +0 -77
  83. data/ruby-lint.yml +0 -25
  84. /data/docs/{basics → additional-details}/migrating-from-react-rails.md +0 -0
  85. /data/docs/{additional-reading → additional-details}/updating-dependencies.md +0 -0
  86. /data/docs/{additional-reading → deployment}/elastic-beanstalk.md +0 -0
  87. /data/docs/{basics → deployment}/heroku-deployment.md +0 -0
  88. /data/docs/{additional-reading → javascript}/angular-js-integration-migration.md +0 -0
  89. /data/docs/{additional-reading → javascript}/asset-pipeline.md +0 -0
  90. /data/docs/{additional-reading → javascript}/capistrano-deployment.md +0 -0
  91. /data/docs/{additional-reading → javascript}/credits.md +0 -0
  92. /data/docs/{additional-reading → javascript}/foreman-issues.md +0 -0
  93. /data/docs/{additional-reading → javascript}/node-dependencies-and-npm.md +0 -0
  94. /data/docs/{additional-reading → javascript}/react-and-redux.md +0 -0
  95. /data/docs/{additional-reading → javascript}/react-helmet.md +0 -0
  96. /data/docs/{additional-reading → javascript}/react-router.md +0 -0
  97. /data/docs/{additional-reading → javascript}/server-rendering-tips.md +0 -0
  98. /data/docs/{additional-reading → javascript}/troubleshooting-when-using-webpacker.md +0 -0
  99. /data/docs/{additional-reading → javascript}/webpack-v1-notes.md +0 -0
  100. /data/docs/{additional-reading → javascript}/webpack.md +0 -0
  101. /data/docs/{coding-style → misc}/style.md +0 -0
  102. /data/docs/{additional-reading → misc}/tips.md +0 -0
  103. /data/docs/{additional-reading → rails}/rails-engine-integration.md +0 -0
  104. /data/docs/{additional-reading → rails}/rails_view_rendering_from_inline_javascript.md +0 -0
  105. /data/docs/{additional-reading → rails}/turbolinks.md +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83e519532dfba4ffcb23379c8d757d4d299aaa11247c718e310e257e3bca3291
4
- data.tar.gz: d328b53abce54b4deb4481addaaef242b6b531c493aa3154784fa8f87f55e7c0
3
+ metadata.gz: 1ff3b26eb01a206fc2f0a4e3a623463d88a4216c95a36c90b2fa55c5717a308c
4
+ data.tar.gz: 28b373978a8eb7502c018e03aeec17058ba65d6ced76a50aa932894c76f835df
5
5
  SHA512:
6
- metadata.gz: e183bc2eaed29538422fbe0984177f9e64dcb7501d96f971e1a1887aae596e9fe2519d78d44c6517af07abe2db44632ba38879e070966641b1faac5e6e984e08
7
- data.tar.gz: 6ab4afd6786b2539428dffcbad518dd0e3cd1111a61d0b81891a715d665e5c7e6d4053d3e344d770808422abb720c07259bd537f6bfe1b5a59f0e0127e96b2ac
6
+ metadata.gz: ccb1f3c3d34b9ddbca43e8fe349a2cb3ee27892a1b52d9fe938070f2947ed402fef03d7328041f4f02a7d0b5401b90cdcdc1141230d96efd2ced6da2bc0668b7
7
+ data.tar.gz: 488f77190eee0fb0ca008535d7fbb8f5a43c380c31c9d4bdacf8d563383a0dc87b0e643eafde37a7d9ffc36e093d8a648c3c95f6b238bf567dcf76caf078027b
data/.circleci/config.yml CHANGED
@@ -2,7 +2,7 @@ version: 2
2
2
 
3
3
  aliases:
4
4
  - &docker-image
5
- - image: circleci/ruby:2.6-node-browsers
5
+ - image: circleci/ruby:2.7-node-browsers
6
6
 
7
7
  # Print critical data and executables versions.
8
8
  - &print-system-info
@@ -31,9 +31,9 @@ aliases:
31
31
  - &install-package-node-modules
32
32
  name: Install Node modules with Yarn for renderer package
33
33
  command: |
34
+ sudo yarn global add yalc
34
35
  yarn install --no-progress --no-emoji
35
36
  yarn run eslint -v
36
- sudo yarn global add yalc
37
37
 
38
38
  # Install/update Node modules for dummy app unless existing set of modules is satisfying Yarn.
39
39
  - &install-dummy-app-node-modules
@@ -274,6 +274,16 @@ jobs:
274
274
  # TODO -- need to leverage Circle CI containers
275
275
  command: |
276
276
  bundle exec rake run_rspec:all_dummy
277
+ # The following step will run only if the main job is finished successfully.
278
+ # Build hook is triggered by curl command described here https://docs.netlify.com/configure-builds/build-hooks/
279
+ # NETLIFY_HOOK is an environment variable on CircleCI to keep sensitive data outside the repo
280
+ - run:
281
+ name: Deploy SC website
282
+ command: |
283
+ if [ $CIRCLE_BRANCH = "master" ]; then
284
+ curl -X POST -d '{}' ${NETLIFY_HOOK}
285
+ fi
286
+ when: on_success
277
287
  - store_test_results:
278
288
  path: ~/rspec
279
289
  - store_artifacts:
data/.eslintrc CHANGED
@@ -1,4 +1,3 @@
1
- ---
2
1
  extends:
3
2
  - eslint-config-shakacode
4
3
  - prettier
@@ -32,8 +31,10 @@ overrides:
32
31
  - "@typescript-eslint"
33
32
  rules:
34
33
  "@typescript-eslint/no-namespace": 0
34
+ "@typescript-eslint/no-shadow": ["error"]
35
35
 
36
36
  rules:
37
+ no-shadow: 0
37
38
  no-console: 0
38
39
  function-paren-newline: 0
39
40
  object-curly-newline: 0
@@ -0,0 +1,53 @@
1
+ name: Lint JS and Ruby
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.7]
10
+ node: [14]
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Setup Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - name: Setup Node
19
+ uses: actions/setup-node@v2-beta
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+ - name: Print system information
23
+ run: |
24
+ echo "Linux release: "; cat /etc/issue
25
+ echo "Current user: "; whoami
26
+ echo "Current directory: "; pwd
27
+ echo "Ruby version: "; ruby -v
28
+ echo "Node version: "; node -v
29
+ echo "Yarn version: "; yarn --version
30
+ echo "Bundler version: "; bundle --version
31
+ - name: Save root node_modules to cache
32
+ uses: actions/cache@v2
33
+ with:
34
+ path: node_modules
35
+ key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
36
+ - name: Save root ruby gems to cache
37
+ uses: actions/cache@v2
38
+ with:
39
+ path: vendor/bundle
40
+ key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }}
41
+ - name: Install Node modules with Yarn for renderer package
42
+ run: |
43
+ yarn install --no-progress --no-emoji
44
+ yarn run eslint -v
45
+ sudo yarn global add yalc
46
+ - name: Install Ruby Gems for package
47
+ run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
48
+ - name: Linting of Ruby
49
+ run: bundle exec rubocop
50
+ - name: Linting of JS
51
+ run: yarn start lint
52
+ - name: Check formatting
53
+ run: yarn start format.listDifferent
@@ -0,0 +1,178 @@
1
+ name: Main test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build-dummy-app-webpack-test-bundles:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.7]
10
+ node: [14]
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Setup Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - name: Setup Node
19
+ uses: actions/setup-node@v2-beta
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+ - name: Print system information
23
+ run: |
24
+ echo "Linux release: "; cat /etc/issue
25
+ echo "Current user: "; whoami
26
+ echo "Current directory: "; pwd
27
+ echo "Ruby version: "; ruby -v
28
+ echo "Node version: "; node -v
29
+ echo "Yarn version: "; yarn --version
30
+ echo "Bundler version: "; bundle --version
31
+ - name: Save root node_modules to cache
32
+ uses: actions/cache@v2
33
+ with:
34
+ path: node_modules
35
+ key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
36
+ - name: Install Node modules with Yarn for renderer package
37
+ run: |
38
+ yarn install --no-progress --no-emoji
39
+ yarn run eslint -v
40
+ sudo yarn global add yalc
41
+ - name: yalc publish for react-on-rails
42
+ run: yalc publish
43
+ - name: Save spec/dummy/node_modules to cache
44
+ uses: actions/cache@v2
45
+ with:
46
+ path: spec/dummy/node_modules
47
+ key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }}
48
+ - name: yalc add react-on-rails
49
+ run: cd spec/dummy && yalc add react-on-rails
50
+ - name: Install Node modules with Yarn for dummy app
51
+ run: cd spec/dummy && yarn install --no-progress --no-emoji
52
+ - name: Save dummy app ruby gems to cache
53
+ uses: actions/cache@v2
54
+ with:
55
+ path: spec/dummy/vendor/bundle
56
+ key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
57
+ - name: Install Ruby Gems for dummy app
58
+ run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
59
+ - name: Build test bundles for dummy app
60
+ run: cd spec/dummy && yarn run build:test
61
+ - id: get-sha
62
+ run: echo "::set-output name=sha::$(git rev-parse HEAD)"
63
+ - name: Save test webpack bundles to cache (for build number checksum used by rspec job)
64
+ uses: actions/cache@v2
65
+ with:
66
+ path: spec/dummy/public/webpack
67
+ key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}
68
+
69
+ main:
70
+ needs: build-dummy-app-webpack-test-bundles
71
+ strategy:
72
+ matrix:
73
+ ruby: [2.7]
74
+ node: [14]
75
+ rake_task: ['run_rspec:all_dummy', 'run_rspec:all_but_examples', 'run_rspec:examples']
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v2
79
+ - name: Setup Ruby
80
+ uses: ruby/setup-ruby@v1
81
+ with:
82
+ ruby-version: ${{ matrix.ruby }}
83
+ - name: Setup Node
84
+ uses: actions/setup-node@v2-beta
85
+ with:
86
+ node-version: ${{ matrix.node }}
87
+ - name: Print system information
88
+ run: |
89
+ echo "Linux release: "; cat /etc/issue
90
+ echo "Current user: "; whoami
91
+ echo "Current directory: "; pwd
92
+ echo "Ruby version: "; ruby -v
93
+ echo "Node version: "; node -v
94
+ echo "Yarn version: "; yarn --version
95
+ echo "Bundler version: "; bundle --version
96
+ - name: Save root node_modules to cache
97
+ uses: actions/cache@v2
98
+ with:
99
+ path: node_modules
100
+ key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
101
+ - name: Save root ruby gems to cache
102
+ uses: actions/cache@v2
103
+ with:
104
+ path: vendor/bundle
105
+ key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }}
106
+ - name: Save dummy app ruby gems to cache
107
+ uses: actions/cache@v2
108
+ with:
109
+ path: spec/dummy/vendor/bundle
110
+ key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
111
+ - name: Save spec/dummy/node_modules to cache
112
+ uses: actions/cache@v2
113
+ with:
114
+ path: spec/dummy/node_modules
115
+ key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }}
116
+ - id: get-sha
117
+ run: echo "::set-output name=sha::$(git rev-parse HEAD)"
118
+ - name: Save test webpack bundles to cache (for build number checksum used by rspec job)
119
+ uses: actions/cache@v2
120
+ with:
121
+ path: spec/dummy/public/webpack
122
+ key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}
123
+
124
+ - name: Install Node modules with Yarn for renderer package
125
+ run: |
126
+ yarn install --no-progress --no-emoji
127
+ yarn run eslint -v
128
+ sudo yarn global add yalc
129
+ - name: yalc publish for react-on-rails
130
+ run: yalc publish
131
+ - name: yalc add react-on-rails
132
+ run: cd spec/dummy && yalc add react-on-rails
133
+ - name: Install Ruby Gems for package
134
+ run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
135
+ - name: Install Ruby Gems for dummy app
136
+ run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
137
+ - name: Ensure minimum required Chrome version
138
+ run: |
139
+ echo -e "Already installed $(google-chrome --version)\n"
140
+ MINIMUM_REQUIRED_CHROME_VERSION=75
141
+ INSTALLED_CHROME_MAJOR_VERSION="$(google-chrome --version | tr ' .' '\t' | cut -f3)"
142
+ if [[ $INSTALLED_CHROME_MAJOR_VERSION < $MINIMUM_REQUIRED_CHROME_VERSION ]]; then
143
+ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
144
+ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
145
+ sudo apt-get update
146
+ sudo apt-get install google-chrome-stable
147
+ echo -e "\nInstalled $(google-chrome --version)"
148
+ fi
149
+ - name: Touch webpack bundles
150
+ run: touch spec/dummy/public/webpack/test/*
151
+ - name: Install yalc globally
152
+ run: sudo yarn global add yalc
153
+ - name: Increase the amount of inotify watchers
154
+ run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
155
+ - name: Prep for CI
156
+ run: bundle exec rake prepare_for_ci
157
+ - name: Main CI
158
+ run: bundle exec rake ${{ matrix.rake_task }}
159
+ - name: Store test results
160
+ uses: actions/upload-artifact@v2
161
+ with:
162
+ name: main-rspec
163
+ path: ~/rspec
164
+ - name: Store artifacts
165
+ uses: actions/upload-artifact@v2
166
+ with:
167
+ name: dummy-app-capybara
168
+ path: spec/dummy/tmp/capybara
169
+ - name: Store artifacts
170
+ uses: actions/upload-artifact@v2
171
+ with:
172
+ name: dummy-app-test-log
173
+ path: spec/dummy/log/test.log
174
+ - name: Store artifacts
175
+ uses: actions/upload-artifact@v2
176
+ with:
177
+ name: dummy-app-yarn-log
178
+ path: spec/dummy/yarn-error.log
@@ -0,0 +1,35 @@
1
+ name: JS unit tests for Renderer package
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ matrix:
9
+ node: [12, 14]
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Setup Node
14
+ uses: actions/setup-node@v2-beta
15
+ with:
16
+ node-version: ${{ matrix.node }}
17
+ - name: Print system information
18
+ run: |
19
+ echo "Linux release: "; cat /etc/issue
20
+ echo "Current user: "; whoami
21
+ echo "Current directory: "; pwd
22
+ echo "Node version: "; node -v
23
+ echo "Yarn version: "; yarn --version
24
+ - name: Save root node_modules to cache
25
+ uses: actions/cache@v2
26
+ with:
27
+ path: node_modules
28
+ key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
29
+ - name: Install Node modules with Yarn for renderer package
30
+ run: |
31
+ yarn install --no-progress --no-emoji
32
+ yarn run eslint -v
33
+ sudo yarn global add yalc
34
+ - name: Run JS unit tests for Renderer package
35
+ run: yarn test
@@ -0,0 +1,45 @@
1
+ name: Rspec test for gem
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.7]
10
+ node: [14]
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Setup Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - name: Print system information
19
+ run: |
20
+ echo "Linux release: "; cat /etc/issue
21
+ echo "Current user: "; whoami
22
+ echo "Current directory: "; pwd
23
+ echo "Ruby version: "; ruby -v
24
+ echo "Node version: "; node -v
25
+ echo "Yarn version: "; yarn --version
26
+ echo "Bundler version: "; bundle --version
27
+ - name: Save root ruby gems to cache
28
+ uses: actions/cache@v2
29
+ with:
30
+ path: vendor/bundle
31
+ key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }}
32
+ - name: Install Ruby Gems for package
33
+ run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
34
+ - name: Run rspec tests
35
+ run: bundle exec rspec spec/react_on_rails
36
+ - name: Store test results
37
+ uses: actions/upload-artifact@v2
38
+ with:
39
+ name: main-rspec
40
+ path: ~/rspec
41
+ - name: Store artifacts
42
+ uses: actions/upload-artifact@v2
43
+ with:
44
+ name: main-test-log
45
+ path: log/test.log
data/.prettierrc CHANGED
@@ -8,9 +8,6 @@ bracketSpacing: true
8
8
  jsxBracketSameLine: false
9
9
  parser: flow
10
10
 
11
- extends:
12
- - tslint-config-prettier
13
-
14
11
  overrides:
15
12
  - files: "*.@(css|scss)"
16
13
  options:
data/.rubocop.yml CHANGED
@@ -1,7 +1,11 @@
1
1
  # This is the configuration used to check the rubocop source code.
2
2
  # Check out: https://github.com/bbatsov/rubocop
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
3
6
 
4
7
  AllCops:
8
+ NewCops: enable
5
9
  DisplayCopNames: true
6
10
  TargetRubyVersion: 2.5
7
11
 
@@ -13,34 +17,25 @@ AllCops:
13
17
  - '**/*.rake'
14
18
 
15
19
  Exclude:
16
- - 'vendor/**/*'
17
- - 'spec/fixtures/**/*'
18
- - 'node_modules/**/.*'
19
- - 'node_modules/**/*'
20
+ <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %>
21
+ - <%= path.sub(/^!! /, '') %>
22
+ <% end %>
23
+ - '**/*.js'
24
+ - '**/node_modules/**/*'
25
+ - '**/public/**/*'
26
+ - '**/tmp/**/*'
20
27
  - 'coverage/**/*'
21
- - 'db/**/*'
22
- - 'db/schema.rb'
23
- - 'db/seeds.rb'
24
- - 'client/node_modules/**/*.*'
25
- - 'client/node_modules/**/.*'
26
- - 'bin/**/*'
27
- - !ruby/regexp /old_and_unused\.rb$/
28
- - 'spec/react_on_rails/dummy-for-generators/**/*'
29
- - 'spec/dummy/Procfile.*'
30
- - 'spec/dummy/bin/**/*'
31
- - 'spec/dummy/node_modules/**/*'
32
- - 'spec/dummy/node_modules/**/.*'
33
- - 'gen-examples/examples/**/.*'
34
28
  - 'gen-examples/examples/**/*'
29
+ - 'node_modules/**/*'
30
+ - 'spec/dummy/bin/*'
31
+ - 'spec/fixtures/**/*'
32
+ - 'spec/react_on_rails/dummy-for-generators/**/*'
33
+ - 'tmp/**/*'
34
+ - 'vendor/**/*'
35
35
 
36
36
  Naming/FileName:
37
37
  Exclude:
38
38
  - 'Gemfile'
39
- - 'spec/dummy/Gemfile'
40
-
41
- # Turn off until we require 2.3 ruby
42
- Style/SafeNavigation:
43
- Enabled: false
44
39
 
45
40
  Layout/LineLength:
46
41
  Max: 120
@@ -94,28 +89,41 @@ Metrics/ModuleLength:
94
89
  Naming/RescuedExceptionsVariableName:
95
90
  Enabled: false
96
91
 
97
- Style/GlobalVars:
92
+ RSpec/AnyInstance:
98
93
  Exclude:
99
- - 'spec/dummy/config/environments/development.rb'
94
+ - 'spec/react_on_rails/git_utils_spec.rb'
95
+ - 'spec/react_on_rails/locales_to_js_spec.rb'
100
96
 
101
- Style/FrozenStringLiteralComment:
102
- EnforcedStyle: always
97
+ RSpec/DescribeClass:
98
+ Enabled: false
103
99
 
104
- Layout/EmptyLinesAroundAttributeAccessor:
105
- Enabled: true
100
+ RSpec/ExampleLength:
101
+ Enabled: false
106
102
 
107
- Layout/SpaceAroundMethodCallOperator:
108
- Enabled: true
103
+ RSpec/MessageSpies:
104
+ Enabled: false
109
105
 
110
- Lint/RaiseException:
111
- Enabled: true
106
+ RSpec/NestedGroups:
107
+ Max: 4
112
108
 
113
- Lint/StructNewOverride:
114
- Enabled: true
109
+ RSpec/BeforeAfterAll:
110
+ Exclude:
111
+ - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb'
112
+ - 'spec/react_on_rails/generators/install_generator_spec.rb'
115
113
 
116
- Style/ExponentialNotation:
117
- Enabled: true
114
+ RSpec/MessageChain:
115
+ Enabled: false
118
116
 
119
- Style/SlicingWithRange:
120
- Enabled: true
117
+ RSpec/MultipleExpectations:
118
+ Enabled: false
119
+
120
+ RSpec/MultipleDescribes:
121
+ Exclude:
122
+ - 'spec/dummy/spec/system/integration_spec.rb'
123
+
124
+ RSpec/MultipleMemoizedHelpers:
125
+ Max: 12
121
126
 
127
+ Style/GlobalVars:
128
+ Exclude:
129
+ - 'spec/dummy/config/environments/development.rb'
data/.travis.yml CHANGED
@@ -39,13 +39,15 @@ install:
39
39
  - node -v
40
40
  - travis_retry npm i -g yarn
41
41
  - travis_retry yarn global add yalc
42
+ - travis_retry yalc add react-on-rails
42
43
  - travis_retry yarn
43
44
  - travis_retry bundle install
44
45
  - travis_retry yarn run build
45
46
  - travis_retry yalc publish
46
- - cd spec/dummy/client
47
+ - cd spec/dummy
47
48
  - travis_retry yalc add react-on-rails
48
49
  - travis_retry yarn
50
+ - cd ../..
49
51
  - bundle exec rake prepare_for_ci
50
52
 
51
53
  before_script:
data/CHANGELOG.md CHANGED
@@ -16,6 +16,30 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
16
16
  Changes since last non-beta release.
17
17
 
18
18
  *Please add entries here for your pull requests that are not yet released.*
19
+
20
+ ### [12.1.0] - 2021-03-23
21
+ #### Added
22
+ - Added the ability to assign a module with a `call` method to `config.build_production_command`. See [the configuration docs](./docs/basics/configuration.md). [PR 1362: Accept custom module for config.build_production_command](https://github.com/shakacode/react_on_rails/pull/1362).
23
+
24
+ #### Fixed
25
+ - Stop setting NODE_ENV value during precompile, as it interferred with rails/webpacker's setting of NODE_ENV to production by default. Fixes [#1334](https://github.com/shakacode/react_on_rails/issues/1334). [PR 1356: Don't set NODE_ENV in assets.rake](https://github.com/shakacode/react_on_rails/pull/1356) by [alexrozanski](https://github.com/alexrozanski).
26
+
27
+ ### [12.0.4] - 2020-11-14
28
+ #### Fixed
29
+ - Install generator now specifies the version. Fixes [React on Rails Generator installs the older npm package #1336](https://github.com/shakacode/react_on_rails/issues/1336). [PR 1338Fix Generator to use Exact NPM Version](https://github.com/shakacode/react_on_rails/pull/1338) by [justin808](https://github.com/justin808).
30
+
31
+ ### [12.0.3] - 2020-09-20
32
+ #### Fixed
33
+ - Async script loading optimizes page load speed. With this fix, a bundle
34
+ can be loaded "async" and a handler function can determine when to hydrate.
35
+ For an example of this, see the [docs for loadable-components SSR](https://loadable-components.com/docs/server-side-rendering/#4-add-loadableready-client-side).
36
+ [PR 1327](https://github.com/shakacode/react_on_rails/pull/1327) by [justin808](https://github.com/justin808).
37
+ Loadable-Components is supported by [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
38
+
39
+ ### [12.0.2] - 2020-07-09
40
+ #### Fixed
41
+ - Remove dependency upon Redux for Typescript types. [PR 1323](https://github.com/shakacode/react_on_rails/pull/1306) by [justin808](https://github.com/justin808).
42
+
19
43
  ### [12.0.1] - 2020-07-09
20
44
  #### Fixed
21
45
  - Changed invocation of webpacker:clean to use a very large number of versions so it does not acidentally delete the server-bundle.js. [PR 1306](https://github.com/shakacode/react_on_rails/pull/1306) by By [justin808](https://github.com/justin808).
@@ -40,8 +64,8 @@ invoked to return the React component. In that case, you won't need to pass any
40
64
  See [docs/basics/upgrading-react-on-rails](./docs/basics/upgrading-react-on-rails.md#upgrading-to-v12)
41
65
  for details.
42
66
 
43
- #### Other Updates
44
- * `react_on_rails` fully supports `rails/webpacker`. The example test app in `spec/dummy` was recently converted over to use rails/webpacker v4+. It's a good example of how to leverage rails/webpacker's webpack configuration for server-side rendering.
67
+ #### Other Updates
68
+ * `react_on_rails` fully supports `rails/webpacker`. The example test app in `spec/dummy` was recently converted over to use rails/webpacker v4+. It's a good example of how to leverage rails/webpacker's webpack configuration for server-side rendering.
45
69
  * Changed the precompile task to use the rails/webpacker one by default
46
70
  * Updated generators to use React hooks
47
71
  * Requires the use of rails/webpacker view helpers
@@ -56,19 +80,19 @@ for details.
56
80
  * Added configuration option `same_bundle_for_client_and_server` with default `false` because
57
81
 
58
82
  1. Production applications would typically have a server bundle that differs from the client bundle
59
- 2. This change only affects trying to use HMR with react_on_rails with rails/webpacker.
60
-
61
- The previous behavior was to always go to the webpack-dev-server for the server bundle if the
62
- webpack-dev-server was running _and_ the server bundle was found in the `manifest.json`.
63
-
83
+ 2. This change only affects trying to use HMR with react_on_rails with rails/webpacker.
84
+
85
+ The previous behavior was to always go to the webpack-dev-server for the server bundle if the
86
+ webpack-dev-server was running _and_ the server bundle was found in the `manifest.json`.
87
+
64
88
  If you are using the **same bundle for client and server rendering**, then set this configuration option
65
89
  to `true`. By [justin808](https://github.com/shakacode/react_on_rails/pull/1240).
66
-
90
+
67
91
  * Added support to export locales in JSON format. New option added `i18n_output_format` which allows to
68
92
  specify locales format either `JSON` or `JS`. **`JSON` format is now the default.**
69
-
93
+
70
94
  **Use this config setting to get the old behavior: config.i18n_output_format = 'js'**
71
-
95
+
72
96
  [PR 1271](https://github.com/shakacode/react_on_rails/pull/1271) by [ashgaliyev](https://github.com/ashgaliyev).
73
97
 
74
98
  - Added Typescript definitions to the Node package. By [justin808](https://github.com/justin808) and [judahmeek](https://github.com/judahmeek) in [PR 1287](https://github.com/shakacode/react_on_rails/pull/1287).
@@ -930,7 +954,11 @@ Best done with Object destructing:
930
954
  ##### Fixed
931
955
  - Fix several generator related issues.
932
956
 
933
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.0.1...master
957
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.1.0...master
958
+ [12.1.0]: https://github.com/shakacode/react_on_rails/compare/12.0.4...12.1.0
959
+ [12.0.4]: https://github.com/shakacode/react_on_rails/compare/12.0.3...12.0.4
960
+ [12.0.3]: https://github.com/shakacode/react_on_rails/compare/12.0.2...12.0.3
961
+ [12.0.2]: https://github.com/shakacode/react_on_rails/compare/12.0.1...12.0.2
934
962
  [12.0.1]: https://github.com/shakacode/react_on_rails/compare/12.0.0...12.0.1
935
963
  [12.0.0]: https://github.com/shakacode/react_on_rails/compare/11.3.0...12.0.0
936
964
  [11.3.0]: https://github.com/shakacode/react_on_rails/compare/11.2.2...11.3.0
data/CONTRIBUTING.md CHANGED
@@ -5,6 +5,7 @@
5
5
  * See other docs in [docs/contributor-info](./docs/contributor-info)
6
6
 
7
7
  ## To run tests:
8
+ * [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
8
9
  * After updating code via git, to prepare all examples and run all tests:
9
10
 
10
11
  ```sh
@@ -62,9 +63,9 @@ cd react_on_rails/
62
63
  yarn
63
64
 
64
65
  # Update the lib directory with babel compiled files
65
- yarn run build:watch
66
+ yarn run build-watch
66
67
  ```
67
-
68
+
68
69
  You need to do this once:
69
70
 
70
71
  ```
@@ -192,7 +193,7 @@ Then run `bundle`.
192
193
 
193
194
  The main installer can be run with ```rails generate react_on_rails:install```
194
195
 
195
- Then use yalc to add the npm module.
196
+ Then use yalc to add the npm module.
196
197
 
197
198
  Be sure that your ran this first at the top level of React on Rails
198
199
 
data/Gemfile CHANGED
@@ -5,36 +5,4 @@ source "https://rubygems.org"
5
5
  # Specify your gem"s dependencies in react_on_rails.gemspec
6
6
  gemspec
7
7
 
8
- # The following gems are dependencies of the gem's dummy/example apps, not the gem itself.
9
- # They must be defined here because of the way Travis CI works, in that it will only
10
- # bundle install from a single Gemfile. Therefore, all gems that we will need for any dummy/example
11
- # app have to be manually added to this file.
12
- gem "bootsnap", ">= 1.1.0", require: false
13
- gem "bootstrap-sass"
14
- gem "jbuilder"
15
- gem "jquery-rails"
16
- gem "mini_racer"
17
- gem "puma"
18
- gem "rails_12factor"
19
- gem "ruby-lint", require: false
20
- gem "sass-rails"
21
- gem "scss_lint", require: false
22
- gem "sdoc", group: :doc
23
- gem "spring"
24
- gem "sprockets", "~>3.0"
25
- gem "sqlite3", "~> 1.3.6"
26
- gem "turbolinks"
27
- gem "uglifier"
28
- gem "web-console", group: :development
29
-
30
- # below are copied from spec/dummy/Gemfile
31
- gem "capybara"
32
- gem "capybara-screenshot"
33
- gem "launchy"
34
- gem "rspec-rails"
35
- gem "rspec-retry"
36
- gem "selenium-webdriver"
37
- gem "webpacker", ">= 4.0.0"
38
-
39
- gem "equivalent-xml", github: "mbklein/equivalent-xml"
40
- gem "rainbow"
8
+ eval_gemfile File.expand_path("./Gemfile.development_dependencies", __dir__)