vue_cli-rails 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e23e30ec06f2e4f661258507ac78cca3ee9b9e2f583fac001b231cfc0194d00f
4
- data.tar.gz: 4fe54577949add5a0739a612bf501ef667c1ac7b3964c0c9e7423f1019d0a46a
3
+ metadata.gz: 6f26555b1ff91f8ef6e62534d9d8b9e901a402193e39704c14d4500692382507
4
+ data.tar.gz: d5c23a4261c2fe607cf070e1155d62efdaea332343dd1383fb72da6a30d8977a
5
5
  SHA512:
6
- metadata.gz: e866c1167152e328b6b1d750dfabcc88ecf495342d493153e319bd2309d85e6554b2d92bae1a95c7545c65631415486765f14e965505f56f10d3de71f4a10a8c
7
- data.tar.gz: d9178061fe4134ab393c386cafd3530aa7fa2e7d3f3d7d485f540fb539f000b87fca2c7b542919e98a7002efaef1f870d6e265113893f25e8b6a0d7352af3747
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.2.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.4)
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
- <!-- <details><summary>Explanation by Demo</summary> -->
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
- <!-- </details> -->
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 |result, fmt|
66
+ formats.each_with_object([[], []]) do |fmt, result|
66
67
  fmts = SUPPORED_FORMATS[fmt.downcase]
67
68
  if fmts
68
69
  result[0] += fmts
@@ -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 { readFileSync, readdirSync, lstatSync } = require('fs');
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/vue.yml'), 'utf8'))[railsEnv];
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/))
@@ -1,5 +1,5 @@
1
1
  module VueCli
2
2
  module Rails
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
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.0
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-12 00:00:00.000000000 Z
11
+ date: 2019-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport