react_for_rails 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/lib/react_for_rails/helper.rb +11 -9
- data/lib/react_for_rails/version.rb +1 -1
- data/lib/react_for_rails.rb +12 -2
- data/node_package/babel.config.js +7 -0
- data/package.json +18 -4
- data/yarn.lock +1579 -0
- metadata +18 -5
- data/lib/react_for_rails/engine.rb +0 -6
- data/node_modules/.yarn-integrity +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d06e1ff85a3b0d708f4350bc8ba6fb93e63a7ba9180be7fcb1c8536fa06a0acb
|
4
|
+
data.tar.gz: ced24b298bfd6d3a8ecfaf9b67755c8f63e7ebb167fb5c24fde4a672d3f7f7a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
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,
|
13
|
+
|
14
|
+
content_tag(:div, '', html_options) +
|
13
15
|
content_tag(
|
14
16
|
:script,
|
15
17
|
props_json.html_safe,
|
16
|
-
type:
|
17
|
-
|
18
|
-
|
19
|
-
class:
|
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
|
data/lib/react_for_rails.rb
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require
|
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
|
data/package.json
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-for-rails",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.4",
|
4
4
|
"description": "npm package for ReactForRails ruby gem",
|
5
|
-
"main": "node_package/
|
5
|
+
"main": "node_package/lib/ReactForRails.js",
|
6
6
|
"files": [
|
7
|
-
"node_package/
|
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
|
}
|