frails 0.7.0 → 0.8.0
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 +4 -1
- data/.rubocop.yml +9 -0
- data/Gemfile +7 -15
- data/Gemfile.lock +54 -106
- data/README.md +11 -27
- 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 +29 -9
- data/lib/frails/component/renderer.rb +4 -0
- data/lib/frails/dev_server.rb +2 -2
- data/lib/frails/helper.rb +2 -0
- data/lib/frails/log_subscriber.rb +1 -1
- data/lib/frails/manifest.rb +1 -5
- data/lib/frails/railtie.rb +4 -4
- data/lib/frails/version.rb +1 -1
- data/lib/tasks/frails.rake +1 -6
- data/package.json +13 -3
- data/package/__snapshots__/config.test.js.snap +10 -0
- data/package/config.js +38 -0
- data/package/config.test.js +7 -0
- data/yarn.lock +4283 -51
- metadata +20 -15
- 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: 98fa123377477094755a4c6fc64a5c36fe5e42c02574c73876f451d28d588438
|
4
|
+
data.tar.gz: 0e9751e40c879a040351437ec42adec6f6cc73938834ed18790d43cc967f3c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4754ad21e2cbaf8176c0a6fdb2a824bd09789e884d39d798a47bfc0be9f9eed2da1ded0b24db669b1bdf27a666a7b4eff5047a015e4f0435d9755299ba12110a
|
7
|
+
data.tar.gz: 605eb4d15e7696c303d1d57d7af64a027132b0c02f1dcd0a9e7f9a78c1fff31834f1c8167859fca27d0fdd37cd387b6640bbe77c186151785b6f7e4bbc5c66f3
|
data/.autotest
ADDED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,11 +1,20 @@
|
|
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
|
14
|
+
Naming/MethodParameterName:
|
15
|
+
Enabled: false
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 20
|
9
18
|
Layout/LineLength:
|
10
19
|
Max: 100
|
11
20
|
Layout/IndentationConsistency:
|
data/Gemfile
CHANGED
@@ -8,18 +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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
gem 'rubocop', require: false, group: :development
|
20
|
-
|
21
|
-
group :test do
|
22
|
-
gem 'byebug'
|
23
|
-
gem 'm'
|
24
|
-
gem 'minitest', '~> 5.0'
|
25
|
-
end
|
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,167 +1,115 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
frails (0.
|
4
|
+
frails (0.8.0)
|
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
|
-
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.0.2.1)
|
17
|
-
actionpack (= 6.0.2.1)
|
18
|
-
activejob (= 6.0.2.1)
|
19
|
-
activerecord (= 6.0.2.1)
|
20
|
-
activestorage (= 6.0.2.1)
|
21
|
-
activesupport (= 6.0.2.1)
|
22
|
-
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.0.2.1)
|
24
|
-
actionpack (= 6.0.2.1)
|
25
|
-
actionview (= 6.0.2.1)
|
26
|
-
activejob (= 6.0.2.1)
|
27
|
-
mail (~> 2.5, >= 2.5.4)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.0.2.1)
|
30
|
-
actionview (= 6.0.2.1)
|
31
|
-
activesupport (= 6.0.2.1)
|
12
|
+
actionpack (6.0.3.2)
|
13
|
+
actionview (= 6.0.3.2)
|
14
|
+
activesupport (= 6.0.3.2)
|
32
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.2.1)
|
39
|
-
activestorage (= 6.0.2.1)
|
40
|
-
activesupport (= 6.0.2.1)
|
41
|
-
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.0.2.1)
|
43
|
-
activesupport (= 6.0.2.1)
|
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.2.1)
|
50
|
-
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.0.2.1)
|
52
|
-
activesupport (= 6.0.2.1)
|
53
|
-
activerecord (6.0.2.1)
|
54
|
-
activemodel (= 6.0.2.1)
|
55
|
-
activesupport (= 6.0.2.1)
|
56
|
-
activestorage (6.0.2.1)
|
57
|
-
actionpack (= 6.0.2.1)
|
58
|
-
activejob (= 6.0.2.1)
|
59
|
-
activerecord (= 6.0.2.1)
|
60
|
-
marcel (~> 0.3.1)
|
61
|
-
activesupport (6.0.2.1)
|
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.2)
|
67
|
-
ast (2.4.
|
30
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
31
|
+
ast (2.4.1)
|
32
|
+
autotest-suffix (1.1.0)
|
68
33
|
builder (3.2.4)
|
69
|
-
|
34
|
+
combustion (1.3.0)
|
35
|
+
activesupport (>= 3.0.0)
|
36
|
+
railties (>= 3.0.0)
|
37
|
+
thor (>= 0.14.6)
|
70
38
|
concurrent-ruby (1.1.6)
|
71
39
|
crass (1.0.6)
|
72
40
|
erubi (1.9.0)
|
73
|
-
|
74
|
-
activesupport (>= 4.2.0)
|
75
|
-
i18n (1.8.2)
|
41
|
+
i18n (1.8.5)
|
76
42
|
concurrent-ruby (~> 1.0)
|
77
|
-
|
78
|
-
loofah (2.4.0)
|
43
|
+
loofah (2.6.0)
|
79
44
|
crass (~> 1.0.2)
|
80
45
|
nokogiri (>= 1.5.9)
|
81
|
-
|
82
|
-
method_source (>= 0.6.7)
|
83
|
-
rake (>= 0.9.2.2)
|
84
|
-
mail (2.7.1)
|
85
|
-
mini_mime (>= 0.1.1)
|
86
|
-
marcel (0.3.3)
|
87
|
-
mimemagic (~> 0.3.2)
|
88
|
-
method_source (0.9.2)
|
89
|
-
mimemagic (0.3.4)
|
90
|
-
mini_mime (1.0.2)
|
46
|
+
method_source (1.0.0)
|
91
47
|
mini_portile2 (2.4.0)
|
92
|
-
minitest (5.14.
|
93
|
-
|
94
|
-
|
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)
|
95
58
|
mini_portile2 (~> 2.4.0)
|
96
|
-
parallel (1.19.
|
97
|
-
parser (2.7.
|
98
|
-
ast (~> 2.4.
|
99
|
-
|
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)
|
100
64
|
rack-proxy (0.6.5)
|
101
65
|
rack
|
102
66
|
rack-test (1.1.0)
|
103
67
|
rack (>= 1.0, < 3)
|
104
|
-
rails (6.0.2.1)
|
105
|
-
actioncable (= 6.0.2.1)
|
106
|
-
actionmailbox (= 6.0.2.1)
|
107
|
-
actionmailer (= 6.0.2.1)
|
108
|
-
actionpack (= 6.0.2.1)
|
109
|
-
actiontext (= 6.0.2.1)
|
110
|
-
actionview (= 6.0.2.1)
|
111
|
-
activejob (= 6.0.2.1)
|
112
|
-
activemodel (= 6.0.2.1)
|
113
|
-
activerecord (= 6.0.2.1)
|
114
|
-
activestorage (= 6.0.2.1)
|
115
|
-
activesupport (= 6.0.2.1)
|
116
|
-
bundler (>= 1.3.0)
|
117
|
-
railties (= 6.0.2.1)
|
118
|
-
sprockets-rails (>= 2.0.0)
|
119
68
|
rails-dom-testing (2.0.3)
|
120
69
|
activesupport (>= 4.2.0)
|
121
70
|
nokogiri (>= 1.6)
|
122
71
|
rails-html-sanitizer (1.3.0)
|
123
72
|
loofah (~> 2.3)
|
124
|
-
railties (6.0.2
|
125
|
-
actionpack (= 6.0.2
|
126
|
-
activesupport (= 6.0.2
|
73
|
+
railties (6.0.3.2)
|
74
|
+
actionpack (= 6.0.3.2)
|
75
|
+
activesupport (= 6.0.3.2)
|
127
76
|
method_source
|
128
77
|
rake (>= 0.8.7)
|
129
78
|
thor (>= 0.20.3, < 2.0)
|
130
79
|
rainbow (3.0.0)
|
131
80
|
rake (13.0.1)
|
132
|
-
|
133
|
-
|
81
|
+
regexp_parser (1.7.1)
|
82
|
+
rexml (3.2.4)
|
83
|
+
rubocop (0.89.0)
|
134
84
|
parallel (~> 1.10)
|
135
|
-
parser (>= 2.7.
|
85
|
+
parser (>= 2.7.1.1)
|
136
86
|
rainbow (>= 2.2.2, < 4.0)
|
87
|
+
regexp_parser (>= 1.7)
|
88
|
+
rexml
|
89
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
137
90
|
ruby-progressbar (~> 1.7)
|
138
|
-
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)
|
139
94
|
ruby-progressbar (1.10.1)
|
140
|
-
sprockets (4.0.0)
|
141
|
-
concurrent-ruby (~> 1.0)
|
142
|
-
rack (> 1, < 3)
|
143
|
-
sprockets-rails (3.2.1)
|
144
|
-
actionpack (>= 4.0)
|
145
|
-
activesupport (>= 4.0)
|
146
|
-
sprockets (>= 3.0.0)
|
147
95
|
thor (1.0.1)
|
148
96
|
thread_safe (0.3.6)
|
149
|
-
tzinfo (1.2.
|
97
|
+
tzinfo (1.2.7)
|
150
98
|
thread_safe (~> 0.1)
|
151
|
-
unicode-display_width (1.
|
152
|
-
|
153
|
-
websocket-extensions (>= 0.1.0)
|
154
|
-
websocket-extensions (0.1.4)
|
155
|
-
zeitwerk (2.2.2)
|
99
|
+
unicode-display_width (1.7.0)
|
100
|
+
zeitwerk (2.4.0)
|
156
101
|
|
157
102
|
PLATFORMS
|
158
103
|
ruby
|
159
104
|
|
160
105
|
DEPENDENCIES
|
161
|
-
|
106
|
+
autotest-suffix
|
107
|
+
combustion
|
162
108
|
frails!
|
163
|
-
m
|
164
109
|
minitest (~> 5.0)
|
110
|
+
minitest-autotest
|
111
|
+
minitest-focus
|
112
|
+
mocha
|
165
113
|
rubocop
|
166
114
|
|
167
115
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -68,14 +68,6 @@ module.exports = {
|
|
68
68
|
}
|
69
69
|
```
|
70
70
|
|
71
|
-
### Compilation for Production
|
72
|
-
|
73
|
-
To take advantage of Rails asset host functionality, we recommend that you compile your assets using the provided Rake task:
|
74
|
-
|
75
|
-
$ rails frails:compile
|
76
|
-
|
77
|
-
This will ensure that you assets respect the `asset_host` configuration.
|
78
|
-
|
79
71
|
### Rails Helpers
|
80
72
|
|
81
73
|
#### `javascript_pack_tag`
|
@@ -194,34 +186,26 @@ module.exports = {
|
|
194
186
|
{
|
195
187
|
// Partials - modules (local)
|
196
188
|
test: /app\/views\/.+(\/_([\w-_]+)\.css)$/,
|
197
|
-
use: ["style-loader", "css-loader"]
|
189
|
+
use: ["style-loader", "css-loader"],
|
198
190
|
},
|
199
191
|
{
|
200
192
|
// Layouts and views - no CSS modules (global)
|
201
193
|
test: /app\/views\/.+(\/[^_]([\w-_]+)\.css)$/,
|
202
|
-
use: ["style-loader", "css-loader"]
|
203
|
-
}
|
204
|
-
]
|
205
|
-
}
|
194
|
+
use: ["style-loader", "css-loader"],
|
195
|
+
},
|
196
|
+
],
|
197
|
+
},
|
206
198
|
};
|
207
199
|
```
|
208
200
|
|
209
201
|
## Configuration
|
210
202
|
|
211
|
-
Frails is built to be as simple as possible, so has very few configuration options
|
212
|
-
|
213
|
-
Be sure to install dotenv-flow package and add that to the very top of your primary webpack config:
|
214
|
-
|
215
|
-
```javascript
|
216
|
-
require("dotenv-flow").config();
|
217
|
-
```
|
218
|
-
|
219
|
-
### Options
|
203
|
+
Frails is built to be as simple as possible, so has very few configuration options:
|
220
204
|
|
221
|
-
- `
|
222
|
-
- `
|
223
|
-
- `
|
224
|
-
- `
|
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`)
|
225
209
|
|
226
210
|
## Development
|
227
211
|
|
@@ -233,6 +217,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
233
217
|
|
234
218
|
Bug reports and pull requests are welcome on GitHub at https://github.com/joelmoss/frails.
|
235
219
|
|
236
|
-
## Thanks
|
220
|
+
## Thanks
|
237
221
|
|
238
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/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
|
data/index.js
CHANGED
@@ -1,35 +1,14 @@
|
|
1
|
-
const
|
2
|
-
|
3
|
-
const rootPath = path.resolve(__dirname, '../../../')
|
4
|
-
const publicOutputPath = process.env.FRAILS_PUBLIC_OUTPUT_PATH || 'assets'
|
5
|
-
|
6
|
-
// Ensure that the publicPath includes our asset host so dynamic imports
|
7
|
-
// (code-splitting chunks and static assets) load from the CDN instead of a relative path.
|
8
|
-
const getPublicPathWithAssetHost = () => {
|
9
|
-
const rootUrl = process.env.RAILS_ASSET_HOST || '/'
|
10
|
-
let packPath = `${publicOutputPath}/`
|
11
|
-
|
12
|
-
// Add relative root prefix to pack path.
|
13
|
-
if (process.env.RAILS_RELATIVE_URL_ROOT) {
|
14
|
-
let relativeRoot = process.env.RAILS_RELATIVE_URL_ROOT
|
15
|
-
relativeRoot = relativeRoot.startsWith('/') ? relativeRoot.substr(1) : relativeRoot
|
16
|
-
packPath = `${ensureTrailingSlash(relativeRoot)}${packPath}`
|
17
|
-
}
|
18
|
-
|
19
|
-
return (rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`) + packPath
|
20
|
-
}
|
1
|
+
const config = require("./package/config");
|
21
2
|
|
22
3
|
module.exports = {
|
23
|
-
|
24
|
-
publicOutputPath,
|
25
|
-
manifestPath: process.env.FRAILS_MANIFEST_PATH || 'manifest.json',
|
26
|
-
devServerPort: process.env.FRAILS_DEV_SERVER_PORT || '8080',
|
27
|
-
devServerHost: process.env.FRAILS_DEV_SERVER_HOST || 'localhost',
|
4
|
+
config,
|
28
5
|
|
29
6
|
// The local ident name required for loading component styles.
|
30
|
-
cssLocalIdentName:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
7
|
+
cssLocalIdentName:
|
8
|
+
config.railsEnv == "development"
|
9
|
+
? "[path][name]__[local]___[md5:hash:hex:6]"
|
10
|
+
: "[local]-[md5:hash:hex:6]",
|
11
|
+
|
12
|
+
sideLoadEntry: require("./package/side_load"),
|
13
|
+
components: require("./package/components"),
|
14
|
+
};
|