react_on_rails 14.0.3 → 14.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f684f9ead5fb7736c7d7836501ac3964144cb63c3e707faf51b0a212251622
4
- data.tar.gz: 376bf8a5fb5d632b28cef7b36272e17a29d5270cca71f2d5c067ec206b3e9a98
3
+ metadata.gz: ca8ba0235b9256e1b24f5afc2c874f258cf239d78ad6490e86ce4d918b26ecf4
4
+ data.tar.gz: 54796b7b8067b98180bf0e41eb20c4d6bb0a4ea54594af8365eb95c74158d1b7
5
5
  SHA512:
6
- metadata.gz: 65b1bd21643a3d515b35082f7655ab4305d2dcb22b4906995f64c9056a06648b070c4b8656f46c2c4b599aed9c4d85468e1d7136d4f56f185db919e7faa05309
7
- data.tar.gz: 145d1f91174c913d97fa171f81f1dd5d1e6daf04c7190094a0552ef6238ce5966cf39f5bd4b075c5a2112da18c108c6e98bd932d2a17799c20ef38efa848c622
6
+ metadata.gz: c081c9e1b626d9c986f212c2c351fd1774fddaa9be301ae05d6c890b41c30f21871acb56002001b2bf64584da3932457ffc9da522463f3d49f7b73dd62852032
7
+ data.tar.gz: 005f0dc9f274c6ba9edc8784efb679e6ba5bc7610b708c7c072f4301f4fe25d3a4bf887ad2e9449284f2bbce346dfec54f0e7bd54192ab8d3532c7d5b3004267
data/CHANGELOG.md CHANGED
@@ -18,6 +18,14 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
18
18
  ### [Unreleased]
19
19
  Changes since the last non-beta release.
20
20
 
21
+ ### [14.0.4] - 2024-07-02
22
+
23
+ #### Improved
24
+ - Improved dependency management by integrating package_json. [PR 1639](https://github.com/shakacode/react_on_rails/pull/1639) by [vaukalak](https://github.com/vaukalak).
25
+
26
+ #### Changed
27
+ - Update outdated GitHub Actions to use Node.js 20.0 versions instead [PR 1623](https://github.com/shakacode/react_on_rails/pull/1623) by [adriangohjw](https://github.com/adriangohjw).
28
+
21
29
  ### [14.0.3] - 2024-06-28
22
30
 
23
31
  #### Fixed
@@ -1140,7 +1148,8 @@ Best done with Object destructing:
1140
1148
  ##### Fixed
1141
1149
  - Fix several generator-related issues.
1142
1150
 
1143
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.0.3...master
1151
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.0.4...master
1152
+ [14.0.4]: https://github.com/shakacode/react_on_rails/compare/14.0.3...14.0.4
1144
1153
  [14.0.3]: https://github.com/shakacode/react_on_rails/compare/14.0.2...14.0.3
1145
1154
  [14.0.2]: https://github.com/shakacode/react_on_rails/compare/14.0.1...14.0.2
1146
1155
  [14.0.1]: https://github.com/shakacode/react_on_rails/compare/14.0.0...14.0.1
@@ -22,7 +22,10 @@ gem "sprockets", "~> 4.0"
22
22
 
23
23
  gem "amazing_print"
24
24
 
25
+ gem "turbo-rails"
26
+
25
27
  group :development, :test do
28
+ gem "package_json"
26
29
  gem "listen"
27
30
  gem "debug"
28
31
  gem "pry"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (14.0.2)
4
+ react_on_rails (14.0.4)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
@@ -93,7 +93,7 @@ GEM
93
93
  bigdecimal (3.1.8)
94
94
  bootsnap (1.18.3)
95
95
  msgpack (~> 1.2)
96
- builder (3.2.4)
96
+ builder (3.3.0)
97
97
  byebug (11.1.3)
98
98
  capybara (3.40.0)
99
99
  addressable
@@ -109,7 +109,7 @@ GEM
109
109
  launchy
110
110
  childprocess (5.0.0)
111
111
  coderay (1.1.3)
112
- concurrent-ruby (1.2.3)
112
+ concurrent-ruby (1.3.3)
113
113
  connection_pool (2.4.1)
114
114
  coveralls (0.8.23)
115
115
  json (>= 1.8, < 3)
@@ -127,7 +127,7 @@ GEM
127
127
  drb (2.2.1)
128
128
  equivalent-xml (0.6.0)
129
129
  nokogiri (>= 1.4.3)
130
- erubi (1.12.0)
130
+ erubi (1.13.0)
131
131
  execjs (2.9.1)
132
132
  ffi (1.16.3)
133
133
  gem-release (2.2.2)
@@ -140,7 +140,7 @@ GEM
140
140
  concurrent-ruby (~> 1.0)
141
141
  interception (0.5)
142
142
  io-console (0.7.2)
143
- irb (1.13.1)
143
+ irb (1.13.2)
144
144
  rdoc (>= 4.0.0)
145
145
  reline (>= 0.4.2)
146
146
  jbuilder (2.12.0)
@@ -170,8 +170,8 @@ GEM
170
170
  matrix (0.4.2)
171
171
  method_source (1.1.0)
172
172
  mini_mime (1.1.5)
173
- mini_portile2 (2.8.6)
174
- minitest (5.23.0)
173
+ mini_portile2 (2.8.7)
174
+ minitest (5.24.1)
175
175
  msgpack (1.7.2)
176
176
  mutex_m (0.2.0)
177
177
  net-imap (0.4.11)
@@ -184,7 +184,7 @@ GEM
184
184
  net-smtp (0.5.0)
185
185
  net-protocol
186
186
  nio4r (2.7.3)
187
- nokogiri (1.16.5)
187
+ nokogiri (1.16.6)
188
188
  mini_portile2 (~> 2.8.2)
189
189
  racc (~> 1.4)
190
190
  package_json (0.1.0)
@@ -211,8 +211,8 @@ GEM
211
211
  public_suffix (5.0.5)
212
212
  puma (6.4.2)
213
213
  nio4r (~> 2.0)
214
- racc (1.7.3)
215
- rack (3.0.11)
214
+ racc (1.8.0)
215
+ rack (3.1.4)
216
216
  rack-proxy (0.7.7)
217
217
  rack
218
218
  rack-session (2.0.0)
@@ -256,22 +256,22 @@ GEM
256
256
  rb-fsevent (0.11.2)
257
257
  rb-inotify (0.10.1)
258
258
  ffi (~> 1.0)
259
- rdoc (6.6.3.1)
259
+ rdoc (6.7.0)
260
260
  psych (>= 4.0.0)
261
261
  regexp_parser (2.9.2)
262
- reline (0.5.7)
262
+ reline (0.5.9)
263
263
  io-console (~> 0.5)
264
264
  rexml (3.2.7)
265
265
  strscan (>= 3.0.9)
266
266
  rspec-core (3.13.0)
267
267
  rspec-support (~> 3.13.0)
268
- rspec-expectations (3.13.0)
268
+ rspec-expectations (3.13.1)
269
269
  diff-lcs (>= 1.2.0, < 2.0)
270
270
  rspec-support (~> 3.13.0)
271
271
  rspec-mocks (3.13.1)
272
272
  diff-lcs (>= 1.2.0, < 2.0)
273
273
  rspec-support (~> 3.13.0)
274
- rspec-rails (6.1.2)
274
+ rspec-rails (6.1.3)
275
275
  actionpack (>= 6.1)
276
276
  activesupport (>= 6.1)
277
277
  railties (>= 6.1)
@@ -358,7 +358,7 @@ GEM
358
358
  sprockets (>= 3.0.0)
359
359
  sqlite3 (1.7.3)
360
360
  mini_portile2 (~> 2.8.0)
361
- stringio (3.1.0)
361
+ stringio (3.1.1)
362
362
  strscan (3.1.0)
363
363
  sync (0.5.0)
364
364
  term-ansicolor (1.8.0)
@@ -369,6 +369,10 @@ GEM
369
369
  tins (1.33.0)
370
370
  bigdecimal
371
371
  sync
372
+ turbo-rails (2.0.6)
373
+ actionpack (>= 6.0.0)
374
+ activejob (>= 6.0.0)
375
+ railties (>= 6.0.0)
372
376
  turbolinks (5.2.1)
373
377
  turbolinks-source (~> 5.2)
374
378
  turbolinks-source (5.2.0)
@@ -389,7 +393,7 @@ GEM
389
393
  xpath (3.2.0)
390
394
  nokogiri (~> 1.8)
391
395
  yard (0.9.36)
392
- zeitwerk (2.6.14)
396
+ zeitwerk (2.6.16)
393
397
 
394
398
  PLATFORMS
395
399
  ruby
@@ -408,6 +412,7 @@ DEPENDENCIES
408
412
  jquery-rails
409
413
  launchy
410
414
  listen
415
+ package_json
411
416
  pry
412
417
  pry-byebug
413
418
  pry-doc
@@ -430,6 +435,7 @@ DEPENDENCIES
430
435
  spring (~> 4.0)
431
436
  sprockets (~> 4.0)
432
437
  sqlite3 (~> 1.6)
438
+ turbo-rails
433
439
  turbolinks
434
440
  uglifier
435
441
  webdrivers (= 5.3.0)
@@ -76,26 +76,40 @@ module ReactOnRails
76
76
  run "bundle"
77
77
  end
78
78
 
79
- def add_yarn_dependencies
79
+ def add_js_dependencies
80
80
  major_minor_patch_only = /\A\d+\.\d+\.\d+\z/
81
81
  if ReactOnRails::VERSION.match?(major_minor_patch_only)
82
- run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact"
82
+ package_json.manager.add(["react-on-rails@#{ReactOnRails::VERSION}"])
83
83
  else
84
84
  # otherwise add latest
85
85
  puts "Adding the latest react-on-rails NPM module. Double check this is correct in package.json"
86
- run "yarn add react-on-rails --exact"
86
+ package_json.manager.add(["react-on-rails"])
87
87
  end
88
88
 
89
89
  puts "Adding React dependencies"
90
- run "yarn add react react-dom @babel/preset-react prop-types babel-plugin-transform-react-remove-prop-types \
91
- babel-plugin-macros"
90
+ package_json.manager.add([
91
+ "react",
92
+ "react-dom",
93
+ "@babel/preset-react",
94
+ "prop-types",
95
+ "babel-plugin-transform-react-remove-prop-types",
96
+ "babel-plugin-macros"
97
+ ])
92
98
 
93
99
  puts "Adding CSS handlers"
94
100
 
95
- run "yarn add -D css-loader css-minimizer-webpack-plugin mini-css-extract-plugin style-loader"
101
+ package_json.manager.add(%w[
102
+ css-loader
103
+ css-minimizer-webpack-plugin
104
+ mini-css-extract-plugin
105
+ style-loader
106
+ ])
96
107
 
97
108
  puts "Adding dev dependencies"
98
- run "yarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh"
109
+ package_json.manager.add([
110
+ "@pmmmwh/react-refresh-webpack-plugin",
111
+ "react-refresh"
112
+ ], type: :dev)
99
113
  end
100
114
 
101
115
  def append_to_spec_rails_helper
@@ -1,8 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "package_json"
3
4
  require "rainbow"
4
5
 
5
6
  module GeneratorHelper
7
+ def package_json
8
+ @package_json ||= PackageJson.read
9
+ end
10
+
6
11
  # Takes a relative path from the destination root, such as `.gitignore` or `app/assets/javascripts/application.js`
7
12
  def dest_file_exists?(file)
8
13
  dest_file = File.join(destination_root, file)
@@ -39,7 +39,9 @@ module ReactOnRails
39
39
  i18n_output_format: nil,
40
40
  components_subdirectory: nil,
41
41
  make_generated_server_bundle_the_entrypoint: false,
42
- defer_generated_component_packs: true
42
+ defer_generated_component_packs: true,
43
+ # forces the loading of React components
44
+ force_load: false
43
45
  )
44
46
  end
45
47
 
@@ -53,7 +55,8 @@ module ReactOnRails
53
55
  :server_render_method, :random_dom_id, :auto_load_bundle,
54
56
  :same_bundle_for_client_and_server, :rendering_props_extension,
55
57
  :make_generated_server_bundle_the_entrypoint,
56
- :defer_generated_component_packs
58
+ :defer_generated_component_packs,
59
+ :force_load
57
60
 
58
61
  # rubocop:disable Metrics/AbcSize
59
62
  def initialize(node_modules_location: nil, server_bundle_js_file: nil, prerender: nil,
@@ -68,7 +71,7 @@ module ReactOnRails
68
71
  same_bundle_for_client_and_server: nil,
69
72
  i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil,
70
73
  random_dom_id: nil, server_render_method: nil, rendering_props_extension: nil,
71
- components_subdirectory: nil, auto_load_bundle: nil)
74
+ components_subdirectory: nil, auto_load_bundle: nil, force_load: nil)
72
75
  self.node_modules_location = node_modules_location.present? ? node_modules_location : Rails.root
73
76
  self.generated_assets_dirs = generated_assets_dirs
74
77
  self.generated_assets_dir = generated_assets_dir
@@ -106,6 +109,7 @@ module ReactOnRails
106
109
  self.auto_load_bundle = auto_load_bundle
107
110
  self.make_generated_server_bundle_the_entrypoint = make_generated_server_bundle_the_entrypoint
108
111
  self.defer_generated_component_packs = defer_generated_component_packs
112
+ self.force_load = force_load
109
113
  end
110
114
  # rubocop:enable Metrics/AbcSize
111
115
 
@@ -441,6 +441,14 @@ module ReactOnRails
441
441
  "data-trace" => (render_options.trace ? true : nil),
442
442
  "data-dom-id" => render_options.dom_id)
443
443
 
444
+ if render_options.force_load
445
+ component_specification_tag.concat(
446
+ content_tag(:script, %(
447
+ ReactOnRails.reactOnRailsComponentLoaded('#{render_options.dom_id}');
448
+ ).html_safe)
449
+ )
450
+ end
451
+
444
452
  load_pack_for_generated_component(react_component_name, render_options)
445
453
  # Create the HTML rendering part
446
454
  result = server_rendered_react_component(render_options)
@@ -91,6 +91,10 @@ module ReactOnRails
91
91
  retrieve_configuration_value_for(:logging_on_server)
92
92
  end
93
93
 
94
+ def force_load
95
+ retrieve_configuration_value_for(:force_load)
96
+ end
97
+
94
98
  def to_s
95
99
  "{ react_component_name = #{react_component_name}, options = #{options}, request_digest = #{request_digest}"
96
100
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "14.0.3"
4
+ VERSION = "14.0.5"
5
5
  end
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: 14.0.3
4
+ version: 14.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-29 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable