vue_cli-rails 0.3.0 → 0.3.1
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 +4 -4
- data/Gemfile.lock +11 -11
- data/README.md +2 -2
- data/lib/helpers/scripts/vue_command.rb +2 -1
- data/lib/source/vue.rails.js +47 -3
- data/lib/tasks/vue.rake +1 -1
- data/lib/vue_cli/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f26555b1ff91f8ef6e62534d9d8b9e901a402193e39704c14d4500692382507
|
4
|
+
data.tar.gz: d5c23a4261c2fe607cf070e1155d62efdaea332343dd1383fb72da6a30d8977a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e33edb9aa638005ae5261d6860cfc49425e752cdf44ab7473ad50ad46816283bc1f4c26aa0d735b33cc99a77ed90c0d39d3b2b2013dd2d74f40a0c3a1eb99103
|
7
|
+
data.tar.gz: 8eb5140657d70b049d1c53e0467f33b16856486a50bd8305fc8778d4fe156d58b3bdba6f9ac054a47e7a501877964a6c993384e4679ccaf29077ddc03c9c9ca7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vue_cli-rails (0.
|
4
|
+
vue_cli-rails (0.3.1)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
rack-proxy (>= 0.6)
|
7
7
|
railties (>= 4.2)
|
@@ -9,20 +9,20 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionpack (5.2.2)
|
13
|
-
actionview (= 5.2.2)
|
14
|
-
activesupport (= 5.2.2)
|
12
|
+
actionpack (5.2.2.1)
|
13
|
+
actionview (= 5.2.2.1)
|
14
|
+
activesupport (= 5.2.2.1)
|
15
15
|
rack (~> 2.0)
|
16
16
|
rack-test (>= 0.6.3)
|
17
17
|
rails-dom-testing (~> 2.0)
|
18
18
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
-
actionview (5.2.2)
|
20
|
-
activesupport (= 5.2.2)
|
19
|
+
actionview (5.2.2.1)
|
20
|
+
activesupport (= 5.2.2.1)
|
21
21
|
builder (~> 3.1)
|
22
22
|
erubi (~> 1.4)
|
23
23
|
rails-dom-testing (~> 2.0)
|
24
24
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
25
|
-
activesupport (5.2.2)
|
25
|
+
activesupport (5.2.2.1)
|
26
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
27
|
i18n (>= 0.7, < 2)
|
28
28
|
minitest (~> 5.1)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
builder (3.2.3)
|
31
31
|
byebug (11.0.0)
|
32
32
|
coderay (1.1.2)
|
33
|
-
concurrent-ruby (1.1.
|
33
|
+
concurrent-ruby (1.1.5)
|
34
34
|
crass (1.0.4)
|
35
35
|
diff-lcs (1.3)
|
36
36
|
erubi (1.8.0)
|
@@ -60,9 +60,9 @@ GEM
|
|
60
60
|
nokogiri (>= 1.6)
|
61
61
|
rails-html-sanitizer (1.0.4)
|
62
62
|
loofah (~> 2.2, >= 2.2.2)
|
63
|
-
railties (5.2.2)
|
64
|
-
actionpack (= 5.2.2)
|
65
|
-
activesupport (= 5.2.2)
|
63
|
+
railties (5.2.2.1)
|
64
|
+
actionpack (= 5.2.2.1)
|
65
|
+
activesupport (= 5.2.2.1)
|
66
66
|
method_source
|
67
67
|
rake (>= 0.8.7)
|
68
68
|
thor (>= 0.19.0, < 2.0)
|
data/README.md
CHANGED
@@ -575,7 +575,7 @@ Currently `vue.config.js` is reading configurations from `vue.rails.js` which de
|
|
575
575
|
|
576
576
|
## Explanation by Demo
|
577
577
|
|
578
|
-
|
578
|
+
<details><summary>Not finished yet</summary>
|
579
579
|
|
580
580
|
### Install
|
581
581
|
|
@@ -741,4 +741,4 @@ Let have a look at `app/assets/vue/manifest.json`:
|
|
741
741
|
}
|
742
742
|
```
|
743
743
|
|
744
|
-
|
744
|
+
</details>
|
@@ -5,6 +5,7 @@ class VueCommand
|
|
5
5
|
|
6
6
|
SUPPORED_FORMATS = {
|
7
7
|
'pug' => %w[pug-plain-loader pug],
|
8
|
+
'slm' => %w[slm-loader slm],
|
8
9
|
'sass' => SASS,
|
9
10
|
'scss' => SASS,
|
10
11
|
'less' => %w[less-loader less],
|
@@ -62,7 +63,7 @@ class VueCommand
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def group_formats(formats)
|
65
|
-
formats.each_with_object([[], []]) do |
|
66
|
+
formats.each_with_object([[], []]) do |fmt, result|
|
66
67
|
fmts = SUPPORED_FORMATS[fmt.downcase]
|
67
68
|
if fmts
|
68
69
|
result[0] += fmts
|
data/lib/source/vue.rails.js
CHANGED
@@ -1,18 +1,57 @@
|
|
1
1
|
const { env } = require('process');
|
2
|
+
const { readFileSync } = require('fs');
|
3
|
+
const { resolve } = require('path');
|
2
4
|
|
3
5
|
module.exports = (() => {
|
4
6
|
let settings = {};
|
5
7
|
const assets = {};
|
8
|
+
const slmModule = (() => {
|
9
|
+
try {
|
10
|
+
const packageJson = readFileSync(resolve(__dirname, 'package.json')) || '{}';
|
11
|
+
const { dependencies, devDependencies } = JSON.parse(packageJson) || {};
|
12
|
+
const deps = { ...dependencies, ...devDependencies };
|
13
|
+
return !(deps.slm && deps['slm-loader']);
|
14
|
+
} catch (_e) {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
})() ? {} : {
|
18
|
+
module: {
|
19
|
+
rules: [
|
20
|
+
{
|
21
|
+
test: /\.slm$/,
|
22
|
+
oneOf: [
|
23
|
+
{
|
24
|
+
resourceQuery: /^\?vue/,
|
25
|
+
use: [
|
26
|
+
{
|
27
|
+
loader: 'slm-loader',
|
28
|
+
},
|
29
|
+
],
|
30
|
+
},
|
31
|
+
{
|
32
|
+
use: [
|
33
|
+
{
|
34
|
+
loader: 'raw-loader',
|
35
|
+
},
|
36
|
+
{
|
37
|
+
loader: 'slm-loader',
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
],
|
42
|
+
},
|
43
|
+
],
|
44
|
+
},
|
45
|
+
};
|
6
46
|
|
7
47
|
try {
|
8
48
|
/* eslint-disable global-require,import/no-extraneous-dependencies */
|
9
49
|
const yaml = require('js-yaml');
|
10
|
-
const {
|
11
|
-
const { resolve } = require('path');
|
50
|
+
const { readdirSync, lstatSync } = require('fs');
|
12
51
|
/* eslint-enable global-require,import/no-extraneous-dependencies */
|
13
52
|
|
14
53
|
const railsEnv = env.RAILS_ENV || 'development';
|
15
|
-
const config = yaml.safeLoad(readFileSync(resolve('config
|
54
|
+
const config = yaml.safeLoad(readFileSync(resolve('config', 'vue.yml'), 'utf8'))[railsEnv];
|
16
55
|
const root = resolve(__dirname);
|
17
56
|
const pop = (config.public_output_path || 'vue_assets').replace(/(^\/+|\/+$)/g, '');
|
18
57
|
const {
|
@@ -72,6 +111,7 @@ module.exports = (() => {
|
|
72
111
|
[key]: resolve(root, alias[key]),
|
73
112
|
}), {}),
|
74
113
|
},
|
114
|
+
...(slmModule || {}),
|
75
115
|
},
|
76
116
|
|
77
117
|
jestModuleNameMapper: Object.keys(alias).reduce((obj, key) => ({
|
@@ -110,6 +150,10 @@ module.exports = (() => {
|
|
110
150
|
cwd: __dirname,
|
111
151
|
encoding: 'utf8',
|
112
152
|
}));
|
153
|
+
|
154
|
+
if (slmModule) {
|
155
|
+
Object.assign(settings.configureWebpack, slmModule);
|
156
|
+
}
|
113
157
|
}
|
114
158
|
|
115
159
|
const getSettingsFromKeys = keys => [].concat(keys).filter(s => s)
|
data/lib/tasks/vue.rake
CHANGED
@@ -5,7 +5,7 @@ namespace :vue do
|
|
5
5
|
VueCreate.run!
|
6
6
|
end
|
7
7
|
|
8
|
-
desc 'Add template/style support: formats=pug,sass,less,stylus'
|
8
|
+
desc 'Add template/style support: formats=pug,slm,sass,less,stylus'
|
9
9
|
task :support, [:formats] do |_t, args|
|
10
10
|
require_relative '../helpers/scripts/vue_command'
|
11
11
|
VueCommand.new.install_format_support(args.formats&.split(/\W/))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vue_cli-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|