frails 0.5.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.autotest +6 -0
- data/.gitignore +8 -1
- data/.rubocop.yml +10 -1
- data/Gemfile +6 -8
- data/Gemfile.lock +64 -109
- data/README.md +18 -27
- data/Rakefile +1 -1
- data/babel.config.js +12 -0
- data/bin/test +5 -3
- data/config.ru +9 -0
- data/frails.gemspec +5 -13
- data/index.js +10 -31
- data/lib/frails.rb +33 -9
- data/lib/frails/component.rb +16 -5
- data/lib/frails/component/{abstract_component.rb → abstract.rb} +11 -9
- data/lib/frails/component/{plain_component.rb → base.rb} +7 -3
- data/lib/frails/component/{react_component.rb → react.rb} +3 -5
- data/lib/frails/component/{react_component_renderer.rb → react_renderer.rb} +22 -16
- data/lib/frails/component/{component_renderer.rb → renderer.rb} +34 -5
- data/lib/frails/component/renderer_concerns.rb +10 -4
- data/lib/frails/component/test_helpers.rb +19 -0
- data/lib/frails/dev_server.rb +2 -2
- data/lib/frails/helper.rb +9 -4
- data/lib/frails/log_subscriber.rb +1 -1
- data/lib/frails/manifest.rb +3 -7
- data/lib/frails/monkey/action_view/partial_renderer.rb +18 -5
- data/lib/frails/monkey/action_view/renderer.rb +6 -7
- data/lib/frails/railtie.rb +4 -4
- data/lib/frails/utils.rb +22 -0
- data/lib/frails/version.rb +1 -1
- data/lib/tasks/frails.rake +1 -6
- data/package.json +18 -4
- data/package/__snapshots__/config.test.js.snap +10 -0
- data/package/components.js +34 -24
- data/package/config.js +29 -0
- data/package/side_load.js +7 -5
- data/yarn.lock +4283 -51
- metadata +27 -21
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40e800d031dda8188539dcd2de1a7a39dcb8a8b92febb17f15c17584822d7413
|
4
|
+
data.tar.gz: 571f9743b449c15ad36138f304921c8bce4b2749195699378dd63fe51cfca378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c488c6f79278e55cc8597958119fa9584d62fa3c092886297096601a290103f1b31b3cba2278f0530f54370f36a7cd5e7682e99e1f756344bef26a70fcb00d9b
|
7
|
+
data.tar.gz: a870cde84bdc3672353ad26197271159db22eeefa429a027e584babc2eb6499aaf035812adee88e36e2fae3feb28534ad46ea677ed31d7b4045f93ddcd18d5ea
|
data/.autotest
ADDED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.4
|
3
|
+
Exclude:
|
4
|
+
- test/dummy/**/*
|
5
|
+
- node_modules/**/*
|
3
6
|
Style/Documentation:
|
4
7
|
Enabled: false
|
5
8
|
Style/ModuleFunction:
|
6
9
|
Enabled: false
|
10
|
+
Style/ClassVars:
|
11
|
+
Enabled: false
|
7
12
|
Style/ClassAndModuleChildren:
|
8
13
|
Enabled: false
|
9
|
-
|
14
|
+
Naming/MethodParameterName:
|
15
|
+
Enabled: false
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 20
|
18
|
+
Layout/LineLength:
|
10
19
|
Max: 100
|
11
20
|
Layout/IndentationConsistency:
|
12
21
|
EnforcedStyle: indented_internal_methods
|
data/Gemfile
CHANGED
@@ -8,12 +8,10 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
8
8
|
# development dependencies will be added by default to the :development group.
|
9
9
|
gemspec
|
10
10
|
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use a debugger
|
17
|
-
# gem 'byebug', group: [:development, :test]
|
18
|
-
|
19
11
|
gem 'rubocop', require: false
|
12
|
+
gem 'combustion'
|
13
|
+
gem 'minitest', '~> 5.0'
|
14
|
+
gem 'minitest-autotest'
|
15
|
+
gem 'minitest-focus'
|
16
|
+
gem 'autotest-suffix'
|
17
|
+
gem 'mocha'
|
data/Gemfile.lock
CHANGED
@@ -1,161 +1,116 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
frails (0.
|
4
|
+
frails (0.8.1)
|
5
|
+
activesupport (>= 6.0)
|
5
6
|
nokogiri (>= 1.10.4)
|
6
7
|
rack-proxy (>= 0.6.5)
|
7
|
-
rails (>= 6.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
actionmailbox (6.0.0)
|
17
|
-
actionpack (= 6.0.0)
|
18
|
-
activejob (= 6.0.0)
|
19
|
-
activerecord (= 6.0.0)
|
20
|
-
activestorage (= 6.0.0)
|
21
|
-
activesupport (= 6.0.0)
|
22
|
-
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.0.0)
|
24
|
-
actionpack (= 6.0.0)
|
25
|
-
actionview (= 6.0.0)
|
26
|
-
activejob (= 6.0.0)
|
27
|
-
mail (~> 2.5, >= 2.5.4)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.0.0)
|
30
|
-
actionview (= 6.0.0)
|
31
|
-
activesupport (= 6.0.0)
|
32
|
-
rack (~> 2.0)
|
12
|
+
actionpack (6.0.3.2)
|
13
|
+
actionview (= 6.0.3.2)
|
14
|
+
activesupport (= 6.0.3.2)
|
15
|
+
rack (~> 2.0, >= 2.0.8)
|
33
16
|
rack-test (>= 0.6.3)
|
34
17
|
rails-dom-testing (~> 2.0)
|
35
18
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
|
37
|
-
|
38
|
-
activerecord (= 6.0.0)
|
39
|
-
activestorage (= 6.0.0)
|
40
|
-
activesupport (= 6.0.0)
|
41
|
-
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.0.0)
|
43
|
-
activesupport (= 6.0.0)
|
19
|
+
actionview (6.0.3.2)
|
20
|
+
activesupport (= 6.0.3.2)
|
44
21
|
builder (~> 3.1)
|
45
22
|
erubi (~> 1.4)
|
46
23
|
rails-dom-testing (~> 2.0)
|
47
24
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
|
49
|
-
activesupport (= 6.0.0)
|
50
|
-
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.0.0)
|
52
|
-
activesupport (= 6.0.0)
|
53
|
-
activerecord (6.0.0)
|
54
|
-
activemodel (= 6.0.0)
|
55
|
-
activesupport (= 6.0.0)
|
56
|
-
activestorage (6.0.0)
|
57
|
-
actionpack (= 6.0.0)
|
58
|
-
activejob (= 6.0.0)
|
59
|
-
activerecord (= 6.0.0)
|
60
|
-
marcel (~> 0.3.1)
|
61
|
-
activesupport (6.0.0)
|
25
|
+
activesupport (6.0.3.2)
|
62
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
63
27
|
i18n (>= 0.7, < 2)
|
64
28
|
minitest (~> 5.1)
|
65
29
|
tzinfo (~> 1.1)
|
66
|
-
zeitwerk (~> 2.
|
67
|
-
ast (2.4.
|
68
|
-
|
69
|
-
|
70
|
-
|
30
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
31
|
+
ast (2.4.1)
|
32
|
+
autotest-suffix (1.1.0)
|
33
|
+
builder (3.2.4)
|
34
|
+
combustion (1.3.0)
|
35
|
+
activesupport (>= 3.0.0)
|
36
|
+
railties (>= 3.0.0)
|
37
|
+
thor (>= 0.14.6)
|
38
|
+
concurrent-ruby (1.1.6)
|
39
|
+
crass (1.0.6)
|
71
40
|
erubi (1.9.0)
|
72
|
-
|
73
|
-
activesupport (>= 4.2.0)
|
74
|
-
i18n (1.6.0)
|
41
|
+
i18n (1.8.5)
|
75
42
|
concurrent-ruby (~> 1.0)
|
76
|
-
|
77
|
-
loofah (2.3.0)
|
43
|
+
loofah (2.6.0)
|
78
44
|
crass (~> 1.0.2)
|
79
45
|
nokogiri (>= 1.5.9)
|
80
|
-
|
81
|
-
mini_mime (>= 0.1.1)
|
82
|
-
marcel (0.3.3)
|
83
|
-
mimemagic (~> 0.3.2)
|
84
|
-
method_source (0.9.2)
|
85
|
-
mimemagic (0.3.3)
|
86
|
-
mini_mime (1.0.2)
|
46
|
+
method_source (1.0.0)
|
87
47
|
mini_portile2 (2.4.0)
|
88
|
-
minitest (5.
|
89
|
-
|
90
|
-
|
48
|
+
minitest (5.14.1)
|
49
|
+
minitest-autotest (1.1.1)
|
50
|
+
minitest-server (~> 1.0)
|
51
|
+
path_expander (~> 1.0)
|
52
|
+
minitest-focus (1.2.1)
|
53
|
+
minitest (>= 4, < 6)
|
54
|
+
minitest-server (1.0.6)
|
55
|
+
minitest (~> 5.0)
|
56
|
+
mocha (1.11.2)
|
57
|
+
nokogiri (1.10.10)
|
91
58
|
mini_portile2 (~> 2.4.0)
|
92
|
-
parallel (1.
|
93
|
-
parser (2.
|
94
|
-
ast (~> 2.4.
|
95
|
-
|
59
|
+
parallel (1.19.2)
|
60
|
+
parser (2.7.1.4)
|
61
|
+
ast (~> 2.4.1)
|
62
|
+
path_expander (1.1.0)
|
63
|
+
rack (2.2.3)
|
96
64
|
rack-proxy (0.6.5)
|
97
65
|
rack
|
98
66
|
rack-test (1.1.0)
|
99
67
|
rack (>= 1.0, < 3)
|
100
|
-
rails (6.0.0)
|
101
|
-
actioncable (= 6.0.0)
|
102
|
-
actionmailbox (= 6.0.0)
|
103
|
-
actionmailer (= 6.0.0)
|
104
|
-
actionpack (= 6.0.0)
|
105
|
-
actiontext (= 6.0.0)
|
106
|
-
actionview (= 6.0.0)
|
107
|
-
activejob (= 6.0.0)
|
108
|
-
activemodel (= 6.0.0)
|
109
|
-
activerecord (= 6.0.0)
|
110
|
-
activestorage (= 6.0.0)
|
111
|
-
activesupport (= 6.0.0)
|
112
|
-
bundler (>= 1.3.0)
|
113
|
-
railties (= 6.0.0)
|
114
|
-
sprockets-rails (>= 2.0.0)
|
115
68
|
rails-dom-testing (2.0.3)
|
116
69
|
activesupport (>= 4.2.0)
|
117
70
|
nokogiri (>= 1.6)
|
118
|
-
rails-html-sanitizer (1.
|
119
|
-
loofah (~> 2.
|
120
|
-
railties (6.0.
|
121
|
-
actionpack (= 6.0.
|
122
|
-
activesupport (= 6.0.
|
71
|
+
rails-html-sanitizer (1.3.0)
|
72
|
+
loofah (~> 2.3)
|
73
|
+
railties (6.0.3.2)
|
74
|
+
actionpack (= 6.0.3.2)
|
75
|
+
activesupport (= 6.0.3.2)
|
123
76
|
method_source
|
124
77
|
rake (>= 0.8.7)
|
125
78
|
thor (>= 0.20.3, < 2.0)
|
126
79
|
rainbow (3.0.0)
|
127
|
-
rake (13.0.
|
128
|
-
|
129
|
-
|
80
|
+
rake (13.0.1)
|
81
|
+
regexp_parser (1.7.1)
|
82
|
+
rexml (3.2.4)
|
83
|
+
rubocop (0.89.0)
|
130
84
|
parallel (~> 1.10)
|
131
|
-
parser (>= 2.
|
85
|
+
parser (>= 2.7.1.1)
|
132
86
|
rainbow (>= 2.2.2, < 4.0)
|
87
|
+
regexp_parser (>= 1.7)
|
88
|
+
rexml
|
89
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
133
90
|
ruby-progressbar (~> 1.7)
|
134
|
-
unicode-display_width (>= 1.4.0, <
|
91
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
92
|
+
rubocop-ast (0.3.0)
|
93
|
+
parser (>= 2.7.1.4)
|
135
94
|
ruby-progressbar (1.10.1)
|
136
|
-
|
137
|
-
concurrent-ruby (~> 1.0)
|
138
|
-
rack (> 1, < 3)
|
139
|
-
sprockets-rails (3.2.1)
|
140
|
-
actionpack (>= 4.0)
|
141
|
-
activesupport (>= 4.0)
|
142
|
-
sprockets (>= 3.0.0)
|
143
|
-
thor (0.20.3)
|
95
|
+
thor (1.0.1)
|
144
96
|
thread_safe (0.3.6)
|
145
|
-
tzinfo (1.2.
|
97
|
+
tzinfo (1.2.7)
|
146
98
|
thread_safe (~> 0.1)
|
147
|
-
unicode-display_width (1.
|
148
|
-
|
149
|
-
websocket-extensions (>= 0.1.0)
|
150
|
-
websocket-extensions (0.1.4)
|
151
|
-
zeitwerk (2.1.10)
|
99
|
+
unicode-display_width (1.7.0)
|
100
|
+
zeitwerk (2.4.0)
|
152
101
|
|
153
102
|
PLATFORMS
|
154
103
|
ruby
|
155
104
|
|
156
105
|
DEPENDENCIES
|
106
|
+
autotest-suffix
|
107
|
+
combustion
|
157
108
|
frails!
|
109
|
+
minitest (~> 5.0)
|
110
|
+
minitest-autotest
|
111
|
+
minitest-focus
|
112
|
+
mocha
|
158
113
|
rubocop
|
159
114
|
|
160
115
|
BUNDLED WITH
|
161
|
-
2.
|
116
|
+
2.1.4
|
data/README.md
CHANGED
@@ -8,6 +8,13 @@ Frails is a modern asset pipeline for [Rails](https://rubyonrails.org), built on
|
|
8
8
|
- Full Webpack control without fighting with the likes of Webpacker.
|
9
9
|
- Embrace modern front end practices.
|
10
10
|
|
11
|
+
PLUS...
|
12
|
+
|
13
|
+
- Side loaded layouts, views and partials.
|
14
|
+
- Components
|
15
|
+
- React + SSR
|
16
|
+
- Ruby/HTML
|
17
|
+
|
11
18
|
## Installation
|
12
19
|
|
13
20
|
Frails is designed to work only within a Rails application, so must be installed in an existing Rails app. It also requires Node.js and a valid `package.json` file in your app root.
|
@@ -61,14 +68,6 @@ module.exports = {
|
|
61
68
|
}
|
62
69
|
```
|
63
70
|
|
64
|
-
### Compilation for Production
|
65
|
-
|
66
|
-
To take advantage of Rails asset host functionality, we recommend that you compile your assets using the provided Rake task:
|
67
|
-
|
68
|
-
$ rails frails:compile
|
69
|
-
|
70
|
-
This will ensure that you assets respect the `asset_host` configuration.
|
71
|
-
|
72
71
|
### Rails Helpers
|
73
72
|
|
74
73
|
#### `javascript_pack_tag`
|
@@ -187,34 +186,26 @@ module.exports = {
|
|
187
186
|
{
|
188
187
|
// Partials - modules (local)
|
189
188
|
test: /app\/views\/.+(\/_([\w-_]+)\.css)$/,
|
190
|
-
use: ["style-loader", "css-loader"]
|
189
|
+
use: ["style-loader", "css-loader"],
|
191
190
|
},
|
192
191
|
{
|
193
192
|
// Layouts and views - no CSS modules (global)
|
194
193
|
test: /app\/views\/.+(\/[^_]([\w-_]+)\.css)$/,
|
195
|
-
use: ["style-loader", "css-loader"]
|
196
|
-
}
|
197
|
-
]
|
198
|
-
}
|
194
|
+
use: ["style-loader", "css-loader"],
|
195
|
+
},
|
196
|
+
],
|
197
|
+
},
|
199
198
|
};
|
200
199
|
```
|
201
200
|
|
202
201
|
## Configuration
|
203
202
|
|
204
|
-
Frails is built to be as simple as possible, so has very few configuration options
|
205
|
-
|
206
|
-
Be sure to install dotenv-flow package and add that to the very top of your primary webpack config:
|
207
|
-
|
208
|
-
```javascript
|
209
|
-
require("dotenv-flow").config();
|
210
|
-
```
|
211
|
-
|
212
|
-
### Options
|
203
|
+
Frails is built to be as simple as possible, so has very few configuration options:
|
213
204
|
|
214
|
-
- `
|
215
|
-
- `
|
216
|
-
- `
|
217
|
-
- `
|
205
|
+
- `Frails.dev_server_host` - The HTTP port that Rails will proxy asset requests to. (default: `8080`)
|
206
|
+
- `Frails.dev_server_path` - The HTTP host that Rails will proxy asset requests to. (default: `localhost`)
|
207
|
+
- `Frails.public_output_path` - The public path where Webpack will output its build to, relative to your app's `/public` directory. (default: `assets`)
|
208
|
+
- `Frails.manifest_path` - Path to the produced Webpack manifest file, relative to the `public_output_path`. (default: `manifest.json`)
|
218
209
|
|
219
210
|
## Development
|
220
211
|
|
@@ -226,6 +217,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
226
217
|
|
227
218
|
Bug reports and pull requests are welcome on GitHub at https://github.com/joelmoss/frails.
|
228
219
|
|
229
|
-
## Thanks
|
220
|
+
## Thanks
|
230
221
|
|
231
222
|
A huge thank you goes out to the peeps behind [Webpacker](https://github.com/rails/webpacker). Frails has borrowed heavily from Webpacker, particularly for the dev server proxy and minifest code. 🙏
|
data/Rakefile
CHANGED
data/babel.config.js
ADDED
data/bin/test
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
$LOAD_PATH << File.expand_path('../test', __dir__)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'rails/plugin/test'
|
data/config.ru
ADDED
data/frails.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'frails/version'
|
3
|
+
require_relative 'lib/frails/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'frails'
|
@@ -12,14 +10,8 @@ Gem::Specification.new do |spec|
|
|
12
10
|
|
13
11
|
spec.summary = 'A Modern [F]ront End on [Rails] and Webpack'
|
14
12
|
spec.homepage = 'https://github.com/joelmoss/frails'
|
15
|
-
|
16
|
-
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
unless spec.respond_to?(:metadata)
|
19
|
-
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
23
15
|
|
24
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
25
17
|
spec.metadata['source_code_uri'] = spec.homepage
|
@@ -34,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
34
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
27
|
spec.require_paths = ['lib']
|
36
28
|
|
37
|
-
spec.add_dependency '
|
29
|
+
spec.add_dependency 'activesupport', '>= 6.0'
|
30
|
+
spec.add_dependency 'nokogiri', '>= 1.10.4'
|
38
31
|
spec.add_dependency 'rack-proxy', '>= 0.6.5'
|
39
|
-
spec.add_dependency 'rails', '>= 6.0'
|
40
32
|
end
|