react_on_rails 12.5.1 → 12.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88901566a8542a69dca5cdad520c369e4fb7308c8e762879833857f98227df4f
4
- data.tar.gz: 4248d3aa6267a69e480f371d543f00440aecc29eb1c26ddc9abd1d6ed06a4a26
3
+ metadata.gz: 42095c4558f10348cc26cb16a990b85bc2a5b7ccdc21d297fa1c461ce3b87ad5
4
+ data.tar.gz: 3592b3bf2a9d21746ea977f3be2c17478b7c440f4905dde5c5d7102e911715ee
5
5
  SHA512:
6
- metadata.gz: dc7a0186cb28fe7e0aa157685228e648ebb64afc991690a4a6dd541e0584b03573deb977553d70ddbe48332ca47108c6af2590f338a1b27491de941b95df4855
7
- data.tar.gz: 6a76d0c809e2a098c1425094f98c19f8cac91f426b7e826bf2f438b1fb15e541f048c4a5bdfb55f2e9c8ae1cc4521433e3d60ad81c1be0c08aaa958d5ea1b0b6
6
+ metadata.gz: f32f47937ffe6af27f69b6f6b95a0ced2cb7b6c268f1c0e7ea04bd55c42c421cf1cae37ff479702bd47de8435bb802ce273e0aff9d533456dfe7a46d4abe9847
7
+ data.tar.gz: 338aef5f7c66e7d167afb518e9c28056b8425b29e9c98d783701ad492b6766b80cc25aaa993dec655941ee855883c15ef32321e6694984a8f2833a3a6629e560
data/.circleci/config.yml CHANGED
@@ -55,7 +55,7 @@ aliases:
55
55
  command: |
56
56
  gem install bundler
57
57
  echo "Bundler version: "; bundle --version
58
- cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
58
+ cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
59
59
 
60
60
  # Install ruby gems unless existing set of gems is satisfying bundler.
61
61
  - &install-package-ruby-gems
@@ -63,6 +63,7 @@ aliases:
63
63
  command: |
64
64
  gem install bundler
65
65
  echo "Bundler version: "; bundle --version
66
+ bundle lock --add-platform 'x86_64-linux'
66
67
  bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
67
68
 
68
69
  # Restore node_modules dir from cache using yarn.lock checksum as a key.
@@ -55,7 +55,7 @@ jobs:
55
55
  path: spec/dummy/vendor/bundle
56
56
  key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
57
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
58
+ run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
59
59
  - name: Build test bundles for dummy app
60
60
  run: cd spec/dummy && yarn run build:test
61
61
  - id: get-sha
@@ -131,9 +131,9 @@ jobs:
131
131
  - name: yalc add react-on-rails
132
132
  run: cd spec/dummy && yalc add react-on-rails
133
133
  - name: Install Ruby Gems for package
134
- run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
134
+ run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
135
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
136
+ run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
137
137
  - name: Ensure minimum required Chrome version
138
138
  run: |
139
139
  echo -e "Already installed $(google-chrome --version)\n"
data/CHANGELOG.md CHANGED
@@ -16,11 +16,14 @@ 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
+ ### [12.5.2] - 2021-12-29
20
+ ### Fixed
21
+ - Usage of config.build_production_command for custom command for production builds fixed. [PR 1415](https://github.com/shakacode/react_on_rails/pull/1415) by [judahmeek](https://github.com/judahmeek).
19
22
 
20
23
  ### [12.5.1] - 2021-12-27
21
24
 
22
25
  ### Fixed
23
- - A fatal server rendering error if running an ReactOnRails >=12.4.0 with ReactOnRails Pro <2.4.0. [PR 1412](https://github.com/shakacode/react_on_rails/pull/1412) by [judahmeek](https://github.com/judahmeek)
26
+ - A fatal server rendering error if running an ReactOnRails >=12.4.0 with ReactOnRails Pro <2.4.0. [PR 1412](https://github.com/shakacode/react_on_rails/pull/1412) by [judahmeek](https://github.com/judahmeek).
24
27
 
25
28
  ### [12.5.0] - 2021-12-26
26
29
 
@@ -990,7 +993,8 @@ Best done with Object destructing:
990
993
  ##### Fixed
991
994
  - Fix several generator related issues.
992
995
 
993
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.5.1...master
996
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/12.5.2...master
997
+ [12.5.2]: https://github.com/shakacode/react_on_rails/compare/12.5.1...12.5.2
994
998
  [12.5.1]: https://github.com/shakacode/react_on_rails/compare/12.5.0...12.5.1
995
999
  [12.5.0]: https://github.com/shakacode/react_on_rails/compare/12.4.0...12.5.0
996
1000
  [12.4.0]: https://github.com/shakacode/react_on_rails/compare/12.3.0...12.4.0
@@ -111,46 +111,79 @@ module ReactOnRails
111
111
  check_i18n_yml_directory_exists
112
112
  check_server_render_method_is_only_execjs
113
113
  error_if_using_webpacker_and_generated_assets_dir_not_match_public_output_path
114
- check_deprecated_settings
114
+ # check_deprecated_settings
115
+ adjust_precompile_task
115
116
  end
116
117
 
117
118
  private
118
119
 
119
- def check_deprecated_settings
120
- if build_production_command.present? &&
121
- ReactOnRails::WebpackerUtils.webpacker_webpack_production_config_exists?
122
- msg = <<~MSG
123
- Setting ReactOnRails configuration for `build_production_command` is
124
- not necessary if you have config/webpack/production.js. When that file
125
- exists, React on Rails DOES NOT modify the standard assets:precompile.
126
- If you want React on Rails to modify to the standard assets:precompile
127
- to use your config/initializers/react_on_rails.rb config.build_production_command
128
- then delete the config/webpack/production.js.
129
- MSG
130
- Rails.logger.warn(msg)
120
+ def adjust_precompile_task
121
+ skip_react_on_rails_precompile = %w[no false n f].include?(ENV["REACT_ON_RAILS_PRECOMPILE"])
122
+
123
+ return if skip_react_on_rails_precompile || build_production_command.blank?
124
+
125
+ # Ensure that rails/webpacker does not call bin/webpack if we're providing
126
+ # the build command.
127
+ ENV["WEBPACKER_PRECOMPILE"] = "false"
128
+
129
+ precompile_tasks = lambda {
130
+ Rake::Task["react_on_rails:assets:webpack"].invoke
131
+ puts "Invoking task webpacker:clean from React on Rails"
132
+
133
+ # VERSIONS is per the rails/webpacker clean method definition.
134
+ # We set it very big so that it is not used, and then clean just
135
+ # removes files older than 1 hour.
136
+ versions = 100_000
137
+ Rake::Task["webpacker:clean"].invoke(versions)
138
+ }
139
+
140
+ if Rake::Task.task_defined?("assets:precompile")
141
+ Rake::Task["assets:precompile"].enhance do
142
+ precompile_tasks.call
143
+ end
144
+ else
145
+ Rake::Task.define_task("assets:precompile") do
146
+ precompile_tasks.call
147
+ end
131
148
  end
132
- #
133
- # msg = <<~MSG
134
- # ReactOnRails configuration for `build_production_command` is removed.
135
- # Move this command into `bin/webpack` converting the script to a shell script.
136
- # MSG
137
- # raise ReactOnRails::Error, msg
138
- # Commenting out until v13 when
139
- # https://github.com/rails/webpacker/issues/2640 gets resolved
140
- # if node_modules_location.present?
141
- # Rails.logger.warn("ReactOnRails configuration for `node_modules_location` is deprecated. "\
142
- # "Instead, prepend a `cd client` (or whichever location) before your test command.")
143
- # end
144
- #
145
- # return unless build_production_command.present?
146
- #
147
- # msg = <<~MSG
148
- # ReactOnRails configuration for `build_production_command` is removed.
149
- # Move this command into `bin/webpack` converting the script to a shell script.
150
- # MSG
151
- # raise ReactOnRails::Error, msg
152
149
  end
153
150
 
151
+ # Pending updates to rails/webpacker v6, we may have some message that prints after configuration runs.
152
+ # def check_deprecated_settings
153
+ # if build_production_command.present? &&
154
+ # ReactOnRails::WebpackerUtils.webpacker_webpack_production_config_exists?
155
+ # msg = <<~MSG
156
+ # Setting ReactOnRails configuration for `build_production_command` is
157
+ # not necessary if you have config/webpack/production.js. When that file
158
+ # exists, React on Rails DOES NOT modify the standard assets:precompile.
159
+ # If you want React on Rails to modify to the standard assets:precompile
160
+ # to use your config/initializers/react_on_rails.rb config.build_production_command
161
+ # then delete the config/webpack/production.js.
162
+ # MSG
163
+ # Rails.logger.warn(msg)
164
+ # end
165
+ #
166
+ # msg = <<~MSG
167
+ # ReactOnRails configuration for `build_production_command` is removed.
168
+ # Move this command into `bin/webpack` converting the script to a shell script.
169
+ # MSG
170
+ # raise ReactOnRails::Error, msg
171
+ # Commenting out until v13 when
172
+ # https://github.com/rails/webpacker/issues/2640 gets resolved
173
+ # if node_modules_location.present?
174
+ # Rails.logger.warn("ReactOnRails configuration for `node_modules_location` is deprecated. "\
175
+ # "Instead, prepend a `cd client` (or whichever location) before your test command.")
176
+ # end
177
+ #
178
+ # return unless build_production_command.present?
179
+ #
180
+ # msg = <<~MSG
181
+ # ReactOnRails configuration for `build_production_command` is removed.
182
+ # Move this command into `bin/webpack` converting the script to a shell script.
183
+ # MSG
184
+ # raise ReactOnRails::Error, msg
185
+ # end
186
+
154
187
  def error_if_using_webpacker_and_generated_assets_dir_not_match_public_output_path
155
188
  return unless ReactOnRails::WebpackerUtils.using_webpacker?
156
189
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "12.5.1"
4
+ VERSION = "12.5.2"
5
5
  end
@@ -1,46 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Important: The default assets:precompile is modified ONLY if the rails/webpacker webpack config
4
- # does not exist!
5
-
6
- require "active_support"
7
-
8
- ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
9
-
10
- skip_react_on_rails_precompile = %w[no false n f].include?(ENV["REACT_ON_RAILS_PRECOMPILE"])
11
-
12
- if !skip_react_on_rails_precompile && ReactOnRails.configuration.build_production_command.present?
13
- # Ensure that rails/webpacker does not call bin/webpack if we're providing
14
- # the build command.
15
- ENV["WEBPACKER_PRECOMPILE"] = "false"
16
-
17
- precompile_tasks = lambda {
18
- Rake::Task["react_on_rails:assets:webpack"].invoke
19
- puts "Invoking task webpacker:clean from React on Rails"
20
-
21
- # VERSIONS is per the rails/webpacker clean method definition.
22
- # We set it very big so that it is not used, and then clean just
23
- # removes files older than 1 hour.
24
- versions = 100_000
25
- Rake::Task["webpacker:clean"].invoke(versions)
26
- }
27
-
28
- if Rake::Task.task_defined?("assets:precompile")
29
- Rake::Task["assets:precompile"].enhance do
30
- precompile_tasks.call
31
- end
32
- else
33
- Rake::Task.define_task("assets:precompile") do
34
- precompile_tasks.call
35
- end
36
- end
37
- end
38
-
39
- # Sprockets independent tasks
40
3
  # rubocop:disable Metrics/BlockLength
41
4
  namespace :react_on_rails do
42
5
  namespace :assets do
43
- desc <<~DESC.strip_heredoc
6
+ desc <<~DESC
44
7
  If config.build_production_command is defined, this command is automatically
45
8
  added to task assets:precompile and the regular webpacker compile will not run.
46
9
  The defined command is either a script or a module with a method `call`.
@@ -65,10 +28,6 @@ namespace :react_on_rails do
65
28
  msg = <<~MSG
66
29
  React on Rails is aborting webpack compilation from task react_on_rails:assets:webpack
67
30
  because you do not have the `config.build_production_command` defined.
68
-
69
- Note, this task may have run as part of `assets:precompile`. If file
70
- config/webpack/production.js does not exist, React on Rails will modify
71
- the default `asset:precompile` to run task `react_on_rails:assets:webpack`.
72
31
  MSG
73
32
  puts Rainbow(msg).red
74
33
  exit!(1)
@@ -3,10 +3,9 @@
3
3
  require "react_on_rails/locales/base"
4
4
  require "react_on_rails/locales/to_js"
5
5
  require "react_on_rails/locales/to_json"
6
- require "active_support"
7
6
 
8
7
  namespace :react_on_rails do
9
- desc <<-DESC.strip_heredoc
8
+ desc <<~DESC
10
9
  Generate i18n javascript files
11
10
  This task generates javascript locale files: `translations.js` & `default.js` and places them in
12
11
  the "ReactOnRails.configuration.i18n_dir".
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "12.5.1",
3
+ "version": "12.5.2",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
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.5.1
4
+ version: 12.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable