vueonrails 1.0.0.beta3 → 1.0.0.beta5

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: 4308786754408c51f8a1e1299c0dffbd7d7f23d42e693815c56474d6a5b2de86
4
- data.tar.gz: 1915f256ee3faddc68ab55ebaee0f958e74338b403f5e6f314a39c4746dcf03a
3
+ metadata.gz: 3d19afa02dc6893103ab2183bad342323b1cfaa8a93ecd49d7b8c2df24fa5f39
4
+ data.tar.gz: ce0746b785e5fa4a31fb29397494b55eda3bc05b07f910f91c6cfb4a2917200e
5
5
  SHA512:
6
- metadata.gz: 4d79f39ad995fba55953daaeef8cdfc387064a548a77cc99511952782ccff674f6700a66209ffa30ef26047d1dbfd21468e572e596e590e6c4ad364ca257260f
7
- data.tar.gz: 00df4fbf3c519c7e1420e1c74d9b5241630daa15302ff667cd1a0dd3b3776aaef837e9db27ff4e92950f1fa8803e3f43c4e8be8decc48d631a25b28ae0067641
6
+ metadata.gz: '08b2fae140adf0e9b3b0ace423751e3438b6197044305831a8d93f76df0486de16784d7a57b5b7e249462084e0ec41e0547669fe93fd0a0809e41811c91eb8c7'
7
+ data.tar.gz: '08e9c0a594645b151d07332732306e38a417591ae522858473da6bac8aad728e08575b5db9d364986dede78b8ee7f71359991b6b988e8e1428e3717559686a0b'
data/README.md CHANGED
@@ -1,23 +1,24 @@
1
1
  ![vue on rails](https://vueonrails.com/assets/img/vueonrails.png)
2
2
 
3
- > Vue for your favorite Rails projects
3
+ > Vue for your favorite Rails products
4
4
 
5
- The Vue on Rails gem makes it easy to build Vue components on your Rails application.
5
+ The Vue on Rails gem makes it easy to build Vue components on your Rails products.
6
6
 
7
7
  It uses Rails 5.x, Vue 2.x, Webpacker 4.x, Ruby 2.x, Node 11.x, Yarn 1.12.x.
8
8
 
9
- - ❄️ Server Side Rendering using Hypernova
10
- - 💎 Compatible with Rails 6/5/4 and Webpacker
11
- - 🌎 Internationalization for component parts
12
9
  - 🖖 Vue UI ready
13
- - 🔨 Component generators and scaffolds
14
- - 📦 Out of the box configuration
15
- - ✂️ Specific-page Vue
10
+ - 🐶 Support pug
16
11
  - 🤡 Jest test ready
12
+ - ✂️ Specific-page Vue
13
+ - 👷🏻️ Asset pipeline helpers
17
14
  - 🎯 Simple state management
15
+ - 📦 Out of the box configuration
16
+ - 🔨 Component generators and scaffolds
17
+ - ❄️ Server Side Rendering using Hypernova
18
18
  - 🗃 Easily migrate to Vuex state management
19
- - 👷🏻️ Asset pipeline helpers
20
- - 🏎 Kickstart with our Vue on Rails application template at https://vueonrails.com/vue
19
+ - 🌎 Internationalization for component parts
20
+ - 💎 Compatible with Rails 6/5/4 and Webpacker
21
+ - 🏎 Kickstart with our application template at https://vueonrails.com/vue
21
22
 
22
23
  It ships out-of-the-box configuration, component generators and other solutions to make life easy for both Vue and Rails.
23
24
 
@@ -27,7 +27,7 @@ module SyntaxHelper
27
27
  end
28
28
 
29
29
  #server side rendering via hypernova
30
- def render_vue(id, name)
31
- render_react_component(id, name: name)
30
+ def render_vue_component(id, data = {})
31
+ render_react_component(id, data)
32
32
  end
33
33
  end
@@ -0,0 +1,14 @@
1
+ pugtemplate = <<-eos
2
+ <template lang="pug">
3
+ ##{name}
4
+ p {{ message }}
5
+ </template>
6
+ eos
7
+
8
+ if options[:seperate] == true
9
+ gsub_file Rails.root.join("#{PARTS_PATH}/#{name}/#{name}.vue").to_s,
10
+ /<template>[^\]]*<\/template>/, pugtemplate
11
+ else
12
+ gsub_file Rails.root.join("#{PARTS_PATH}/#{name}.vue").to_s,
13
+ /<template>[^\]]*<\/template>/, pugtemplate
14
+ end
@@ -1,5 +1,5 @@
1
1
  // Generated by Vue on Rails https://github.com/vueonrails/vueonrails
2
- // Embed this component
2
+ // To embed this component in Rails view, use <%= render_vue_component "component.js" %>
3
3
  // To generate this component, run `rails generate vue something --ssr`
4
4
 
5
5
  console.log("Hello, <%= name %>")
@@ -19,6 +19,7 @@ class VueGenerator < Rails::Generators::NamedBase
19
19
  table: {type: :boolean, default: false},
20
20
  modal: {type: :boolean, default: false},
21
21
  click: {type: :boolean, default: false},
22
+ pug: {type: :boolean, default: false}
22
23
  }.freeze
23
24
 
24
25
  class_option :ssr, type: :string, default: nil
@@ -0,0 +1,15 @@
1
+ // Generated by Vue on Rails https://github.com/vueonrails/vueonrails
2
+ // This is required to support Pug in Vue on Rails.
3
+
4
+ module.exports = {
5
+ test: /\.pug$/,
6
+ oneOf: [
7
+ {
8
+ resourceQuery: /^\?vue/,
9
+ use: ['pug-plain-loader']
10
+ },
11
+ {
12
+ use: ['raw-loader', 'pug-plain-loader']
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,12 @@
1
+ # install pug dependencies
2
+ run "yarn add pug pug-plain-loader"
3
+
4
+ # add the pug loader
5
+ copy_file "#{__dir__}/loaders/pug.js", Rails.root.join("config/webpack/loaders/pug.js").to_s
6
+
7
+ # insert pug into the environment.js
8
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
9
+ "const pug = require('./loaders/pug')\n", after: "require('@rails/webpacker')\n"
10
+
11
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
12
+ "environment.loaders.prepend('pug', pug)\n", before: "module.exports = environment"
@@ -1,8 +1,8 @@
1
1
  # Check for the lack of .babelrc or webpacker 4
2
2
  def check_version_and_babel
3
3
  #should i check for evidence of webpacker:install?
4
- File.exists?(Rails.root.join(".babelrc")) == false \
5
- || (Gem.loaded_specs["webpacker"].version < Gem::Version.new('4.x')) == false
4
+ (File.exists?(Rails.root.join(".babelrc")) == true) \
5
+ || ((Gem.loaded_specs["webpacker"].version >= Gem::Version.new('4.x')) == false)
6
6
  end
7
7
 
8
8
  begin
@@ -33,10 +33,16 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
33
33
  "const alias = require('./alias/alias')\n", after: "require('@rails/webpacker')\n"
34
34
 
35
35
  # Add *_pack_tag into application.html.erb This is essential for specific-page vue setup.
36
- pack_tag = <<-eos
37
- <%= javascript_pack_tag 'application' %>
38
- <%= stylesheet_pack_tag 'application' %>
39
- eos
36
+ if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
37
+ pack_tag = <<-eos
38
+ <%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
39
+ eos
40
+ else # non-rails 6
41
+ pack_tag = <<-eos
42
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
43
+ <%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
44
+ eos
45
+ end
40
46
 
41
47
  insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
42
48
  pack_tag, before: " </head>\n"
@@ -83,19 +89,6 @@ eos
83
89
  insert_into_file Rails.root.join("package.json").to_s,
84
90
  scripts, after: "\"private\": true,\n"
85
91
 
86
- babelrc = <<-eos
87
- "env": {
88
- "test": {
89
- "presets": [
90
- ["env", { "targets": { "node": "current" }}]
91
- ]
92
- }
93
- },
94
- eos
95
-
96
- insert_into_file Rails.root.join(".babelrc").to_s,
97
- babelrc, before: " \"presets\": ["
98
-
99
92
  # Insert locale.js as a default i18n and add second locale cn.yml
100
93
  copy_file "#{__dir__}/../generators/templates/i18n/index.js", Rails.root.join("app/javascript/locales/locale.js").to_s
101
94
  copy_file "#{__dir__}/../generators/templates/i18n/cn.yml", Rails.root.join("config/locales/cn.yml").to_s
data/lib/installs/spv.rb CHANGED
@@ -3,10 +3,17 @@ gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
3
3
  gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
4
4
  /<\/body>/, '<% end %>'
5
5
 
6
- pack_tag = <<-eos
7
- <%= javascript_pack_tag 'application' %>
8
- <%= stylesheet_pack_tag 'application' %>
9
- eos
6
+ if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
7
+ pack_tag = <<-eos
8
+ <%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ eos
10
+ else # non-rails 6
11
+ pack_tag = <<-eos
12
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
13
+ <%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
14
+ eos
15
+ end
16
+
10
17
 
11
18
  insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
12
19
  pack_tag,
@@ -18,4 +25,4 @@ eos
18
25
 
19
26
  insert_into_file Rails.root.join("app/assets/javascripts/application.js").to_s,
20
27
  vue_on_rails,
21
- before: "//= require_tree ."
28
+ before: "//= require_tree ."
@@ -1,3 +1,7 @@
1
+ // Generated by Vue on Rails https://github.com/vueonrails/vueonrails
2
+ // To embed this component in Rails view, use <%= render_vue_component "component.js" %>
3
+ // To generate this component, run `rails generate vue something --ssr`
4
+
1
5
  console.log("hello, component")
2
6
  const Vue = require("vue")
3
7
  const renderVue = require("hypernova-vue").renderVue
@@ -1,9 +1,13 @@
1
+ // Generated by Vue on Rails https://github.com/vueonrails/vueonrails
2
+ // To run this script, simply run `node ssr`
3
+
1
4
  var hypernova = require('hypernova/server');
2
5
 
3
6
  hypernova({
4
7
  devMode: true,
5
8
  getComponent(name) {
6
- // console.log("The component name is -> " + name)
9
+ // Console.log("The component name is -> " + name)
10
+ // Make sure you state the corresponding name correctly. In this case, 'component.js'
7
11
  if (name === 'component.js') {
8
12
  return require('./app/javascript/ssr/component.js')
9
13
  }
data/lib/installs/test.rb CHANGED
@@ -28,16 +28,4 @@ insert_into_file Rails.root.join("package.json").to_s,
28
28
  "#{scripts}",
29
29
  after: "\"private\": true,\n"
30
30
 
31
- babelrc = <<-eos
32
- "test": {
33
- "presets": [
34
- ["env", { "targets": { "node": "current" }}]
35
- ]
36
- },
37
- eos
38
-
39
- insert_into_file Rails.root.join(".babelrc").to_s,
40
- "#{babelrc}",
41
- before: " \"presets\": ["
42
-
43
- run "yarn add jest-serializer-vue vue-jest babel-jest --no-progress --silent"
31
+ run "yarn add jest-serializer-vue vue-jest babel-jest --no-progress --silent"
@@ -1,4 +1,3 @@
1
1
  module Vueonrails
2
- # VERSION = "0.3.1"
3
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0.beta5"
4
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vueonrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
4
+ version: 1.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Lim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-10 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,6 +57,7 @@ files:
57
57
  - lib/generators/options/list.rb
58
58
  - lib/generators/options/modal.rb
59
59
  - lib/generators/options/parent.rb
60
+ - lib/generators/options/pug.rb
60
61
  - lib/generators/options/seperate.rb
61
62
  - lib/generators/options/single.rb
62
63
  - lib/generators/options/ssr.rb
@@ -82,6 +83,8 @@ files:
82
83
  - lib/installs/Procfile
83
84
  - lib/installs/config/alias.js
84
85
  - lib/installs/i18n.rb
86
+ - lib/installs/loaders/pug.js
87
+ - lib/installs/pug.rb
85
88
  - lib/installs/setup.rb
86
89
  - lib/installs/spv.rb
87
90
  - lib/installs/ssr.rb