react_for_rails 0.0.1 → 0.0.4

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: 9854257125995e1a483db136b560e75176004af5e83043001be76ea654542f6d
4
- data.tar.gz: e200204f2b5466fe98bfa6e5538bf98e80d9b8991977886026cd9735a2aee469
3
+ metadata.gz: d06e1ff85a3b0d708f4350bc8ba6fb93e63a7ba9180be7fcb1c8536fa06a0acb
4
+ data.tar.gz: ced24b298bfd6d3a8ecfaf9b67755c8f63e7ebb167fb5c24fde4a672d3f7f7a6
5
5
  SHA512:
6
- metadata.gz: 6e58856cb17aacedecd3b85cfc7dae710c4fd165d6a31c65c06966beaf54780efa4a29ee68465e22e964a06c03a5db7482a64f09581eb571c29a34c9b6f9c20f
7
- data.tar.gz: e118639eafbf219f7d64571bb574ec05708b221653dfa370d817000170247c37718fd28df0b8f979acdb24afdd145f45179e7d4dacb090f1516a312d3b669ccc
6
+ metadata.gz: 862d8b5e98cdde66e54b5f104cbf4e6975a493eb2d0a7d230c09b98d6d6c54ed46a57bb6637b456386ecaf5dde884689c21ff645700e989ba81654b2dc18539b
7
+ data.tar.gz: d13f6f3acfe3ebd3d1c9299c5a2694d0c5ee934e3e5a72f4e193fdf2ea75acaf0419468c5eac2e30eace8c3367eef35ea3ca88f21d9a78f67594dd4b4cc9c78d
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require "rubocop/rake_task"
8
+ require 'rubocop/rake_task'
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ReactForRails
2
4
  module Helper
3
5
  def react_component(name, options = {})
4
6
  props = options[:props] || {}
5
7
  props_json = ERB::Util.json_escape(props.is_a?(String) ? props : props.to_json)
6
-
8
+
7
9
  id = "react-component-#{SecureRandom.hex(8)}"
8
-
10
+
9
11
  html_options = options[:html_options] || {}
10
12
  html_options[:id] = id
11
-
12
- content_tag(:div, "", html_options) +
13
+
14
+ content_tag(:div, '', html_options) +
13
15
  content_tag(
14
16
  :script,
15
17
  props_json.html_safe,
16
- type: "application/json",
17
- "data-dom-id" => id,
18
- "data-component-name" => name,
19
- class: "custom-react-component-render"
18
+ type: 'application/json',
19
+ 'data-dom-id' => id,
20
+ 'data-component-name' => name,
21
+ class: 'custom-react-component-render'
20
22
  )
21
23
  end
22
24
  end
23
- end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactForRails
4
- VERSION = "0.0.1"
4
+ VERSION = '0.0.4'
5
5
  end
@@ -1,4 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "react_for_rails/version"
4
- require "react_for_rails/helper"
3
+ require_relative 'react_for_rails/version'
4
+ require 'react_for_rails/helper'
5
+
6
+ module ReactForRails
7
+ class Railtie < Rails::Railtie
8
+ initializer 'react_for_rails.add_helpers' do
9
+ ActiveSupport.on_load(:action_view) do
10
+ include ReactForRails::Helper
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ presets: ["@babel/preset-env"],
3
+ plugins: [
4
+ "@babel/plugin-proposal-nullish-coalescing-operator",
5
+ "@babel/plugin-proposal-class-properties",
6
+ ],
7
+ };
data/package.json CHANGED
@@ -1,15 +1,22 @@
1
1
  {
2
2
  "name": "react-for-rails",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "description": "npm package for ReactForRails ruby gem",
5
- "main": "node_package/src/ReactForRails.js",
5
+ "main": "node_package/lib/ReactForRails.js",
6
6
  "files": [
7
- "node_package/src"
7
+ "node_package/lib"
8
8
  ],
9
+ "dependencies": {
10
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
11
+ "@babel/runtime-corejs3": "^7.25.6"
12
+ },
9
13
  "peerDependencies": {
10
14
  "react": ">= 18",
11
15
  "react-dom": ">= 18"
12
16
  },
17
+ "scripts": {
18
+ "build": "babel node_package/src --out-dir node_package/lib --config-file ./node_package/babel.config.js"
19
+ },
13
20
  "repository": {
14
21
  "type": "git",
15
22
  "url": "git+https://github.com/wszeborowskimateusz/react-for-rails.git"
@@ -24,5 +31,12 @@
24
31
  "bugs": {
25
32
  "url": "https://github.com/wszeborowskimateusz/react-for-rails/issues"
26
33
  },
27
- "homepage": "https://github.com/wszeborowskimateusz/react-for-rails#readme"
34
+ "homepage": "https://github.com/wszeborowskimateusz/react-for-rails#readme",
35
+ "devDependencies": {
36
+ "@babel/cli": "^7.25.6",
37
+ "@babel/core": "^7.25.2",
38
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
39
+ "@babel/preset-env": "^7.25.4",
40
+ "@babel/preset-react": "^7.24.7"
41
+ }
28
42
  }