react_on_rails 12.0.4 → 12.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +12 -2
- data/.eslintrc +2 -0
- data/.github/workflows/lint-js-and-ruby.yml +3 -3
- data/.github/workflows/main.yml +6 -6
- data/.github/workflows/package-js-tests.yml +2 -2
- data/.github/workflows/rspec-package-specs.yml +2 -2
- data/.prettierrc +0 -3
- data/.rubocop.yml +40 -8
- data/CHANGELOG.md +38 -14
- data/CONTRIBUTING.md +3 -2
- data/Gemfile.development_dependencies +6 -9
- data/NEWS.md +0 -1
- data/README.md +59 -58
- data/Rakefile +1 -1
- data/docs/{basics → additional-details}/generator-details.md +1 -6
- data/docs/{outdated → additional-details}/manual-installation-overview.md +6 -6
- data/docs/{basics → additional-details}/migrating-from-react-rails.md +0 -0
- data/docs/{additional-reading → additional-details}/recommended-project-structure.md +0 -0
- data/docs/{additional-reading → additional-details}/updating-dependencies.md +0 -0
- data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +10 -0
- data/docs/api/javascript-api.md +2 -2
- data/docs/api/redux-store-api.md +3 -3
- data/docs/api/view-helpers-api.md +7 -8
- data/docs/basics/client-vs-server-rendering.md +3 -3
- data/docs/basics/configuration.md +45 -25
- data/docs/basics/deployment.md +2 -2
- data/docs/{outdated → basics}/how-react-on-rails-works.md +8 -9
- data/docs/basics/installation-into-an-existing-rails-app.md +13 -6
- data/docs/basics/react-server-rendering.md +3 -3
- data/docs/basics/rspec-configuration.md +10 -10
- data/docs/{tutorial.md → basics/tutorial.md} +22 -30
- data/docs/basics/upgrading-react-on-rails.md +7 -7
- data/docs/basics/webpack-configuration.md +4 -6
- data/docs/contributor-info/linters.md +5 -6
- data/docs/contributor-info/pull-requests.md +2 -4
- data/docs/contributor-info/releasing.md +1 -1
- data/docs/{additional-reading → deployment}/elastic-beanstalk.md +0 -0
- data/docs/{basics → deployment}/heroku-deployment.md +0 -0
- data/docs/home.md +382 -0
- data/docs/{additional-reading → javascript}/angular-js-integration-migration.md +0 -0
- data/docs/{additional-reading → javascript}/asset-pipeline.md +0 -0
- data/docs/{additional-reading → javascript}/capistrano-deployment.md +0 -0
- data/docs/{outdated → javascript}/code-splitting.md +3 -3
- data/docs/{additional-reading → javascript}/converting-from-custom-webpack-config-to-rails-webpacker-config.md +3 -3
- data/docs/{additional-reading → javascript}/credits.md +0 -0
- data/docs/{additional-reading → javascript}/foreman-issues.md +0 -0
- data/docs/{additional-reading → javascript}/images.md +5 -6
- data/docs/{additional-reading → javascript}/node-dependencies-and-npm.md +0 -0
- data/docs/{additional-reading → javascript}/react-and-redux.md +0 -0
- data/docs/{additional-reading → javascript}/react-helmet.md +0 -0
- data/docs/{additional-reading → javascript}/react-router.md +0 -0
- data/docs/{additional-reading → javascript}/server-rendering-tips.md +0 -0
- data/docs/{additional-reading → javascript}/troubleshooting-when-using-webpacker.md +0 -0
- data/docs/{additional-reading → javascript}/webpack-v1-notes.md +0 -0
- data/docs/{additional-reading → javascript}/webpack.md +0 -0
- data/docs/{articles.md → misc/articles.md} +1 -1
- data/docs/misc/doctrine.md +5 -5
- data/docs/{coding-style → misc}/style.md +0 -0
- data/docs/{additional-reading → misc}/tips.md +0 -0
- data/docs/outdated/deferred-rendering.md +39 -0
- data/docs/outdated/rails-assets-relative-paths.md +3 -3
- data/docs/outdated/rails-assets.md +8 -8
- data/docs/outdated/rails3.md +2 -2
- data/docs/rails-webpacker-react-integration-options.md +182 -0
- data/docs/{additional-reading → rails}/convert-rails-5-api-only-app.md +1 -1
- data/docs/{additional-reading → rails}/rails-engine-integration.md +0 -0
- data/docs/{additional-reading → rails}/rails_view_rendering_from_inline_javascript.md +0 -0
- data/docs/{additional-reading → rails}/turbolinks.md +13 -1
- data/docs/testimonials/testimonials.md +6 -6
- data/lib/generators/react_on_rails/base_generator.rb +1 -1
- data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
- data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +4 -1
- data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +1 -1
- data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb +2 -2
- data/lib/react_on_rails/helper.rb +23 -5
- data/lib/react_on_rails/locales/base.rb +13 -10
- data/lib/react_on_rails/prerender_error.rb +1 -1
- data/lib/react_on_rails/react_component/render_options.rb +16 -7
- data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +2 -0
- data/lib/react_on_rails/utils.rb +16 -2
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/webpacker_utils.rb +5 -1
- data/lib/tasks/assets.rake +14 -5
- data/package.json +24 -29
- data/rakelib/release.rake +22 -6
- data/rakelib/run_rspec.rake +1 -1
- data/rakelib/task_helpers.rb +15 -2
- data/yarn.lock +2549 -5169
- metadata +39 -37
- data/.release-it.json +0 -3
- data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +0 -10
File without changes
|
File without changes
|
@@ -1,4 +1,15 @@
|
|
1
|
-
# Turbolinks
|
1
|
+
# Turbolinks and Turbo
|
2
|
+
|
3
|
+
## Updated to support Turbo
|
4
|
+
* See [PR 1374](https://github.com/shakacode/react_on_rails/pull/1374).
|
5
|
+
* Ability to use with Turbo (@hotwired/turbo), as Turbolinks gets obsolete.
|
6
|
+
|
7
|
+
To configure turbo the following option can be set:
|
8
|
+
`ReactOnRails.setOptions({ turbo: true })`
|
9
|
+
|
10
|
+
Turbo is not auto-detected like older Turbolinks.
|
11
|
+
|
12
|
+
*Below docs maybe outdated*
|
2
13
|
|
3
14
|
* See [Turbolinks on Github](https://github.com/rails/turbolinks)
|
4
15
|
* React on Rails currently supports 2.5.x of Turbolinks and 5.0.0 of Turbolinks 5.
|
@@ -73,6 +84,7 @@ To turn on tracing of Turbolinks events, put this in your registration file, whe
|
|
73
84
|
```js
|
74
85
|
ReactOnRails.setOptions({
|
75
86
|
traceTurbolinks: true,
|
87
|
+
turbo: true,
|
76
88
|
});
|
77
89
|
```
|
78
90
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# Testimonials
|
2
|
-
# [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](
|
2
|
+
# [HVMN Testimonial, Written by Paul Benigeri, October 12, 2018](https://www.shakacode.com/react-on-rails/docs/testimonials/hvmn)
|
3
3
|
|
4
4
|
> The price we paid for the consultation + the React on Rails pro license has already been made back a couple of times from hosting fees alone. The entire process was super hands off, and our core team was able to focus on shipping new feature during that sprint.
|
5
5
|
|
6
|
-
Full writeup [here](
|
6
|
+
Full writeup [here](https://www.shakacode.com/react-on-rails/docs/testimonials/hvmn).
|
7
7
|
|
8
8
|
---
|
9
9
|
|
10
|
-
# [Leora from ResortPass](
|
10
|
+
# [Leora from ResortPass](https://www.shakacode.com/react-on-rails/docs/testimonials/resortpass), December 10, 2018
|
11
11
|
|
12
|
-
Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds.
|
12
|
+
Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds.
|
13
13
|
|
14
|
-
Full writeup [here](
|
14
|
+
Full writeup [here](https://www.shakacode.com/react-on-rails/docs/testimonials/resortpass).
|
15
15
|
|
16
16
|
---
|
17
17
|
|
@@ -25,4 +25,4 @@ From Kyle Maune of Cooper Aerial, May 4, 2018
|
|
25
25
|
|
26
26
|
![image](https://user-images.githubusercontent.com/1118459/40891236-9b0b406e-671d-11e8-80ee-c026dbd1d5a2.png)
|
27
27
|
|
28
|
-
For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](KUDOS.md).
|
28
|
+
For more testimonials, see [Live Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) and [Kudos](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md).
|
@@ -132,7 +132,7 @@ module ReactOnRails
|
|
132
132
|
# From https://github.com/rails/rails/blob/4c940b2dbfb457f67c6250b720f63501d74a45fd/railties/lib/rails/generators/rails/app/app_generator.rb
|
133
133
|
def app_name
|
134
134
|
@app_name ||= (defined_app_const_base? ? defined_app_name : File.basename(destination_root))
|
135
|
-
.tr(
|
135
|
+
.tr("\\", "").tr(". ", "_")
|
136
136
|
end
|
137
137
|
|
138
138
|
def defined_app_name
|
@@ -13,7 +13,6 @@ require_relative "spec_helper"
|
|
13
13
|
require "rspec/rails"
|
14
14
|
require "capybara/rspec"
|
15
15
|
require "capybara/rails"
|
16
|
-
Capybara.javascript_driver = :selenium_chrome
|
17
16
|
Capybara.register_driver :selenium_chrome do |app|
|
18
17
|
options = Selenium::WebDriver::Chrome::Options.new
|
19
18
|
options.add_argument("--headless")
|
@@ -41,6 +40,10 @@ end
|
|
41
40
|
# ActiveRecord::Migration.maintain_test_schema!
|
42
41
|
|
43
42
|
RSpec.configure do |config|
|
43
|
+
config.before(:each, type: :system, js: true) do
|
44
|
+
driven_by :selenium_chrome
|
45
|
+
end
|
46
|
+
|
44
47
|
# Ensure that if we are running js tests, we are using latest webpack assets
|
45
48
|
# This will use the defaults of :js and :server_rendering meta tags
|
46
49
|
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
|
data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb
RENAMED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require_relative "../rails_helper"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
describe "Hello World", js: true do
|
6
|
+
it "the hello world example works" do
|
7
7
|
visit "/hello_world"
|
8
8
|
expect(heading).to have_text("Hello World")
|
9
9
|
expect(message).to have_text("Stranger")
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# rubocop:disable Metrics/ModuleLength
|
4
|
+
# rubocop:disable Metrics/MethodLength
|
4
5
|
# NOTE:
|
5
6
|
# For any heredoc JS:
|
6
7
|
# 1. The white spacing in this file matters!
|
@@ -170,7 +171,7 @@ module ReactOnRails
|
|
170
171
|
def redux_store_hydration_data
|
171
172
|
return if @registered_stores_defer_render.blank?
|
172
173
|
|
173
|
-
@registered_stores_defer_render.reduce(""
|
174
|
+
@registered_stores_defer_render.reduce(+"") do |accum, redux_store_data|
|
174
175
|
accum << render_redux_store_data(redux_store_data)
|
175
176
|
end.html_safe
|
176
177
|
end
|
@@ -182,7 +183,7 @@ module ReactOnRails
|
|
182
183
|
# Helper method to take javascript expression and returns the output from evaluating it.
|
183
184
|
# If you have more than one line that needs to be executed, wrap it in an IIFE.
|
184
185
|
# JS exceptions are caught and console messages are handled properly.
|
185
|
-
# Options include:{ prerender:, trace:, raise_on_prerender_error: }
|
186
|
+
# Options include:{ prerender:, trace:, raise_on_prerender_error:, throw_js_errors: }
|
186
187
|
def server_render_js(js_expression, options = {})
|
187
188
|
render_options = ReactOnRails::ReactComponent::RenderOptions
|
188
189
|
.new(react_component_name: "generic-js", options: options)
|
@@ -192,6 +193,8 @@ module ReactOnRails
|
|
192
193
|
var htmlResult = '';
|
193
194
|
var consoleReplayScript = '';
|
194
195
|
var hasErrors = false;
|
196
|
+
var renderingError = null;
|
197
|
+
var renderingErrorObject = {};
|
195
198
|
|
196
199
|
try {
|
197
200
|
htmlResult =
|
@@ -199,9 +202,17 @@ module ReactOnRails
|
|
199
202
|
return #{js_expression};
|
200
203
|
})();
|
201
204
|
} catch(e) {
|
205
|
+
renderingError = e;
|
206
|
+
if (#{render_options.throw_js_errors}) {
|
207
|
+
throw e;
|
208
|
+
}
|
202
209
|
htmlResult = ReactOnRails.handleError({e: e, name: null,
|
203
210
|
jsCode: '#{escape_javascript(js_expression)}', serverSide: true});
|
204
211
|
hasErrors = true;
|
212
|
+
renderingErrorObject = {
|
213
|
+
message: renderingError.message,
|
214
|
+
stack: renderingError.stack,
|
215
|
+
}
|
205
216
|
}
|
206
217
|
|
207
218
|
consoleReplayScript = ReactOnRails.buildConsoleReplay();
|
@@ -209,7 +220,8 @@ module ReactOnRails
|
|
209
220
|
return JSON.stringify({
|
210
221
|
html: htmlResult,
|
211
222
|
consoleReplayScript: consoleReplayScript,
|
212
|
-
hasErrors: hasErrors
|
223
|
+
hasErrors: hasErrors,
|
224
|
+
renderingError: renderingErrorObject
|
213
225
|
});
|
214
226
|
|
215
227
|
})()
|
@@ -255,8 +267,13 @@ module ReactOnRails
|
|
255
267
|
i18nLocale: I18n.locale,
|
256
268
|
i18nDefaultLocale: I18n.default_locale,
|
257
269
|
rorVersion: ReactOnRails::VERSION,
|
270
|
+
# TODO: v13 just use the version if existing
|
258
271
|
rorPro: ReactOnRails::Utils.react_on_rails_pro?
|
259
272
|
}
|
273
|
+
if ReactOnRails::Utils.react_on_rails_pro?
|
274
|
+
result[:rorProVersion] = ReactOnRails::Utils.react_on_rails_pro_version
|
275
|
+
end
|
276
|
+
|
260
277
|
if defined?(request) && request.present?
|
261
278
|
# Check for encoding of the request's original_url and try to force-encoding the
|
262
279
|
# URLs as UTF-8. This situation can occur in browsers that do not encode the
|
@@ -487,13 +504,13 @@ module ReactOnRails
|
|
487
504
|
end
|
488
505
|
|
489
506
|
def initialize_redux_stores
|
490
|
-
result =
|
507
|
+
result = +<<-JS
|
491
508
|
ReactOnRails.clearHydratedStores();
|
492
509
|
JS
|
493
510
|
|
494
511
|
return result unless @registered_stores.present? || @registered_stores_defer_render.present?
|
495
512
|
|
496
|
-
declarations = "var reduxProps, store, storeGenerator;\n"
|
513
|
+
declarations = +"var reduxProps, store, storeGenerator;\n"
|
497
514
|
all_stores = (@registered_stores || []) + (@registered_stores_defer_render || [])
|
498
515
|
|
499
516
|
result << all_stores.each_with_object(declarations) do |redux_store_data, memo|
|
@@ -522,3 +539,4 @@ module ReactOnRails
|
|
522
539
|
end
|
523
540
|
end
|
524
541
|
# rubocop:enable Metrics/ModuleLength
|
542
|
+
# rubocop:enable Metrics/MethodLength
|
@@ -32,12 +32,12 @@ module ReactOnRails
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def exist_files
|
35
|
-
@exist_files ||= files.select
|
35
|
+
@exist_files ||= files.select { |file| File.exist?(file) }
|
36
36
|
end
|
37
37
|
|
38
38
|
def files_are_outdated
|
39
|
-
latest_yml = locale_files.map
|
40
|
-
earliest = exist_files.map
|
39
|
+
latest_yml = locale_files.map { |file| File.mtime(file) }.max
|
40
|
+
earliest = exist_files.map { |file| File.mtime(file) }.min
|
41
41
|
latest_yml > earliest
|
42
42
|
end
|
43
43
|
|
@@ -54,15 +54,18 @@ module ReactOnRails
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def locale_files
|
57
|
+
# rubocop:disable Layout/IndentationWidth, Style/RedundantBegin
|
57
58
|
@locale_files ||= begin
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
if i18n_yml_dir.present?
|
60
|
+
Dir["#{i18n_yml_dir}/**/*.yml"]
|
61
|
+
else
|
62
|
+
ReactOnRails::Utils.truthy_presence(
|
63
|
+
Rails.application && Rails.application.config.i18n.load_path
|
64
|
+
).presence
|
65
|
+
end
|
65
66
|
end
|
67
|
+
|
68
|
+
# rubocop:enable Layout/IndentationWidth, Style/RedundantBegin
|
66
69
|
end
|
67
70
|
|
68
71
|
def i18n_dir
|
@@ -46,7 +46,7 @@ module ReactOnRails
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def calc_message(component_name, console_messages, err, js_code, props)
|
49
|
-
message = "ERROR in SERVER PRERENDERING\n"
|
49
|
+
message = +"ERROR in SERVER PRERENDERING\n"
|
50
50
|
if err
|
51
51
|
message << <<~MSG
|
52
52
|
Encountered error: \"#{err}\"
|
@@ -11,6 +11,7 @@ module ReactOnRails
|
|
11
11
|
|
12
12
|
NO_PROPS = {}.freeze
|
13
13
|
|
14
|
+
# TODO: remove the required for named params
|
14
15
|
def initialize(react_component_name: required("react_component_name"), options: required("options"))
|
15
16
|
@react_component_name = react_component_name.camelize
|
16
17
|
@options = options
|
@@ -18,12 +19,16 @@ module ReactOnRails
|
|
18
19
|
|
19
20
|
attr_reader :react_component_name
|
20
21
|
|
22
|
+
def throw_js_errors
|
23
|
+
options.fetch(:throw_js_errors, false)
|
24
|
+
end
|
25
|
+
|
21
26
|
def props
|
22
27
|
options.fetch(:props) { NO_PROPS }
|
23
28
|
end
|
24
29
|
|
25
30
|
def random_dom_id
|
26
|
-
|
31
|
+
retrieve_configuration_value_for(:random_dom_id)
|
27
32
|
end
|
28
33
|
|
29
34
|
def dom_id
|
@@ -49,23 +54,23 @@ module ReactOnRails
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def prerender
|
52
|
-
|
57
|
+
retrieve_configuration_value_for(:prerender)
|
53
58
|
end
|
54
59
|
|
55
60
|
def trace
|
56
|
-
|
61
|
+
retrieve_configuration_value_for(:trace)
|
57
62
|
end
|
58
63
|
|
59
64
|
def replay_console
|
60
|
-
|
65
|
+
retrieve_configuration_value_for(:replay_console)
|
61
66
|
end
|
62
67
|
|
63
68
|
def raise_on_prerender_error
|
64
|
-
|
69
|
+
retrieve_configuration_value_for(:raise_on_prerender_error)
|
65
70
|
end
|
66
71
|
|
67
72
|
def logging_on_server
|
68
|
-
|
73
|
+
retrieve_configuration_value_for(:logging_on_server)
|
69
74
|
end
|
70
75
|
|
71
76
|
def to_s
|
@@ -76,6 +81,10 @@ module ReactOnRails
|
|
76
81
|
options[key]
|
77
82
|
end
|
78
83
|
|
84
|
+
def set_option(key, value)
|
85
|
+
options[key] = value
|
86
|
+
end
|
87
|
+
|
79
88
|
private
|
80
89
|
|
81
90
|
attr_reader :options
|
@@ -88,7 +97,7 @@ module ReactOnRails
|
|
88
97
|
"#{base_dom_id}-#{SecureRandom.uuid}"
|
89
98
|
end
|
90
99
|
|
91
|
-
def
|
100
|
+
def retrieve_configuration_value_for(key)
|
92
101
|
options.fetch(key) do
|
93
102
|
ReactOnRails.configuration.public_send(key)
|
94
103
|
end
|
@@ -187,8 +187,10 @@ module ReactOnRails
|
|
187
187
|
end
|
188
188
|
|
189
189
|
# Reimplement console methods for replaying on the client
|
190
|
+
# Save a handle to the original console if needed.
|
190
191
|
def console_polyfill
|
191
192
|
<<~JS
|
193
|
+
var debugConsole = console;
|
192
194
|
var console = { history: [] };
|
193
195
|
['error', 'log', 'info', 'warn'].forEach(function (level) {
|
194
196
|
console[level] = function () {
|
data/lib/react_on_rails/utils.rb
CHANGED
@@ -158,15 +158,29 @@ module ReactOnRails
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def self.gem_available?(name)
|
161
|
-
Gem
|
161
|
+
Gem.loaded_specs[name].present?
|
162
162
|
rescue Gem::LoadError
|
163
163
|
false
|
164
164
|
rescue StandardError
|
165
165
|
Gem.available?(name).present?
|
166
166
|
end
|
167
167
|
|
168
|
+
# Todo -- remove this for v13, as we don't need both boolean and number
|
168
169
|
def self.react_on_rails_pro?
|
169
|
-
@react_on_rails_pro
|
170
|
+
return @react_on_rails_pro if defined?(@react_on_rails_pro)
|
171
|
+
|
172
|
+
@react_on_rails_pro = gem_available?("react_on_rails_pro")
|
173
|
+
end
|
174
|
+
|
175
|
+
# Return an empty string if React on Rails Pro is not installed
|
176
|
+
def self.react_on_rails_pro_version
|
177
|
+
return @react_on_rails_pro_version if defined?(@react_on_rails_pro_version)
|
178
|
+
|
179
|
+
@react_on_rails_pro_version = if react_on_rails_pro?
|
180
|
+
Gem.loaded_specs["react_on_rails_pro"].version.to_s
|
181
|
+
else
|
182
|
+
""
|
183
|
+
end
|
170
184
|
end
|
171
185
|
|
172
186
|
def self.smart_trim(str, max_length = 1000)
|
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
module ReactOnRails
|
4
4
|
module WebpackerUtils
|
5
|
+
# TODO: V13 code should be cleaned up so that the webpacker gem is required.
|
6
|
+
# This check should only be done at startup.
|
5
7
|
def self.using_webpacker?
|
6
|
-
|
8
|
+
return @using_webpacker if defined?(@using_webpacker)
|
9
|
+
|
10
|
+
@using_webpacker = ReactOnRails::Utils.gem_available?("webpacker")
|
7
11
|
end
|
8
12
|
|
9
13
|
def self.webpacker_webpack_production_config_exists?
|
data/lib/tasks/assets.rake
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
require "active_support"
|
7
7
|
|
8
8
|
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
9
|
-
ENV["NODE_ENV"] ||= "development"
|
10
9
|
|
11
10
|
unless ReactOnRails::WebpackerUtils.webpacker_webpack_production_config_exists?
|
12
11
|
# Ensure that rails/webpacker does not call bin/webpack if we're providing
|
@@ -47,10 +46,20 @@ namespace :react_on_rails do
|
|
47
46
|
configuration file config/webpack/production.js exists.
|
48
47
|
DESC
|
49
48
|
task webpack: :locale do
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
build_production_command = ReactOnRails.configuration.build_production_command
|
50
|
+
if build_production_command.present?
|
51
|
+
if build_production_command.is_a?(String)
|
52
|
+
sh ReactOnRails::Utils.prepend_cd_node_modules_directory(
|
53
|
+
build_production_command
|
54
|
+
).to_s
|
55
|
+
elsif build_production_command.methods.include?(:call)
|
56
|
+
build_production_command.call
|
57
|
+
else
|
58
|
+
msg = "ReactonRails.configuration.build_production_command is improperly configured. "\
|
59
|
+
"Value = #{build_production_command} with class #{build_production_command.class}"
|
60
|
+
puts Rainbow(msg).red
|
61
|
+
exit!(1)
|
62
|
+
end
|
54
63
|
else
|
55
64
|
msg = <<~MSG
|
56
65
|
React on Rails is aborting webpack compilation from task react_on_rails:assets:webpack
|
data/package.json
CHANGED
@@ -1,56 +1,51 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-on-rails",
|
3
|
-
"version": "12.0
|
3
|
+
"version": "12.3.0",
|
4
4
|
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
|
5
5
|
"main": "node_package/lib/ReactOnRails.js",
|
6
6
|
"directories": {
|
7
7
|
"doc": "docs"
|
8
8
|
},
|
9
9
|
"devDependencies": {
|
10
|
-
"@babel/cli": "^7.
|
11
|
-
"@babel/core": "^7.
|
12
|
-
"@babel/plugin-transform-runtime": "^7.
|
13
|
-
"@babel/plugin-transform-typescript": "^7.
|
14
|
-
"@babel/preset-env": "^7.
|
15
|
-
"@babel/preset-react": "^7.
|
16
|
-
"@babel/types": "^7.
|
17
|
-
"@types/jest": "^
|
18
|
-
"@types/node": "^
|
10
|
+
"@babel/cli": "^7.12.10",
|
11
|
+
"@babel/core": "^7.12.10",
|
12
|
+
"@babel/plugin-transform-runtime": "^7.12.10",
|
13
|
+
"@babel/plugin-transform-typescript": "^7.12.1",
|
14
|
+
"@babel/preset-env": "^7.12.10",
|
15
|
+
"@babel/preset-react": "^7.12.10",
|
16
|
+
"@babel/types": "^7.12.10",
|
17
|
+
"@types/jest": "^26.0.18",
|
18
|
+
"@types/node": "^14.14.11",
|
19
19
|
"@types/react": "^16.9.23",
|
20
20
|
"@types/react-dom": "^16.9.5",
|
21
21
|
"@types/turbolinks": "^5.2.0",
|
22
|
-
"@typescript-eslint/eslint-plugin": "^
|
23
|
-
"@typescript-eslint/parser": "^
|
24
|
-
"babel-loader": "^8.0.2",
|
22
|
+
"@typescript-eslint/eslint-plugin": "^4.10.0",
|
23
|
+
"@typescript-eslint/parser": "^4.10.0",
|
25
24
|
"babelify": "^10.0.0",
|
26
25
|
"blue-tape": "^1.0.0",
|
27
26
|
"create-react-class": "^15.6.0",
|
28
|
-
"eslint": "^
|
29
|
-
"eslint-config-prettier": "^
|
27
|
+
"eslint": "^7.15.0",
|
28
|
+
"eslint-config-prettier": "^7.0.0",
|
30
29
|
"eslint-config-shakacode": "^16.0.1",
|
31
|
-
"eslint-plugin-import": "^2.
|
32
|
-
"eslint-plugin-jsx-a11y": "^6.1
|
33
|
-
"eslint-plugin-prettier": "^3.
|
34
|
-
"eslint-plugin-react": "^7.
|
35
|
-
"jest": "^
|
36
|
-
"jsdom": "^
|
30
|
+
"eslint-plugin-import": "^2.22.1",
|
31
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
32
|
+
"eslint-plugin-prettier": "^3.3.0",
|
33
|
+
"eslint-plugin-react": "^7.21.5",
|
34
|
+
"jest": "^26.6.3",
|
35
|
+
"jsdom": "^16.4.0",
|
37
36
|
"nps": "^5.9.3",
|
38
|
-
"prettier": "^2.
|
37
|
+
"prettier": "^2.2.1",
|
39
38
|
"prettier-eslint-cli": "^5.0.0",
|
40
39
|
"prop-types": "^15.5.10",
|
41
40
|
"react": "^16.5.2",
|
42
41
|
"react-dom": "^16.5.2",
|
43
42
|
"react-transform-hmr": "^1.0.4",
|
44
43
|
"redux": "^4.0.1",
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"tslint-config-prettier": "^1.18.0",
|
48
|
-
"typescript": "^3.8.3",
|
49
|
-
"webpack": "^3.4.1",
|
50
|
-
"webpack-manifest-plugin": "^1.2.1"
|
44
|
+
"ts-jest": "^26.4.4",
|
45
|
+
"typescript": "^4.1.2"
|
51
46
|
},
|
52
47
|
"dependencies": {
|
53
|
-
"@babel/runtime-corejs3": "^7.
|
48
|
+
"@babel/runtime-corejs3": "^7.12.5",
|
54
49
|
"concurrently": "^5.1.0"
|
55
50
|
},
|
56
51
|
"peerDependencies": {
|