svelte-on-rails 0.0.27 → 0.0.29

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eca3dd8708bc889d9ae91fb041e8b717fd3a01e7284826cf644dd526d7cbdffc
4
- data.tar.gz: 1206959ce1a1c2a428faf76ab606a43acf1bdc8c8e7188e68e0c39225719510d
3
+ metadata.gz: 15999c6d05393547b3711e946165a7aaae7784cc5d24e55848991ad4772bb266
4
+ data.tar.gz: 20c1b98dd7eeb8938b60836115909695e77ffdceba17244e85a279cae7b57ad2
5
5
  SHA512:
6
- metadata.gz: 8399eb534ceade658383e042a25042e814935cae9f0e48580780c582b545dbbb29d4e99ac886b210873f9beb25d8f735a8f2b7a22b78f8752857614912a865ec
7
- data.tar.gz: 0db580b51db77febbc22f3ca3a4977fc5c0350868917c8b210cbba4c390d763067f454dda591bbae47a9c89323a32420d96b45cafe51638ab7d4c8a2a90b5b9f
6
+ metadata.gz: d71688f76d82e82432610e3ea68c8e483dfc2ebdffd47ba9916783655986754c909d8e64a750d119fad5f7dfdab884176ab0e0f067931e9fc588601afbcc234b
7
+ data.tar.gz: 0b213226ab03bf76bd999ff7d875b43c14a1968563dc1851d3d6fedb6a0142bfac7258f8f906a277b9bc1a0fa1bfd09f9b471deabae21ee07aed02080bf11fea
@@ -2,21 +2,14 @@ module SvelteOnRails
2
2
  module Installer
3
3
  module HelloWorld
4
4
 
5
- def self.install_hello_world
5
+ def self.install_hello_world(files)
6
6
 
7
7
  utils_i = SvelteOnRails::Installer::Utils
8
8
 
9
9
  # write templates
10
10
 
11
- templates = %w[
12
- app/controllers/svelte_on_rails_hello_world_controller.rb
13
- app/views/svelte_on_rails_hello_world/index.haml
14
- app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte
15
- app/frontend/javascript/components/sub/NestedComponent.svelte
16
- app/frontend/images/svg.svg
17
- app/frontend/images/check-circle-green.png
18
- ]
19
- utils_i.write_templates(templates)
11
+
12
+ utils_i.write_templates(files)
20
13
 
21
14
 
22
15
  # route
@@ -42,16 +35,10 @@ module SvelteOnRails
42
35
 
43
36
  end
44
37
 
45
- def self.remove_hello_world
38
+ def self.remove_hello_world(files)
46
39
 
47
40
  utils = SvelteOnRails::Installer::Utils
48
41
  if utils.ask_yn('Remove the Hello World component?')
49
- files = %w[
50
- app/views/svelte_on_rails_hello_world/index.haml
51
- app/views/svelte_on_rails_hello_world
52
- app/controllers/svelte_on_rails_hello_world_controller.rb
53
- app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte
54
- ]
55
42
  utils.remove_files(files)
56
43
  utils.remove_line_from_file('config/routes.rb', 'svelte_on_rails_hello_world')
57
44
  end
@@ -1,8 +1,9 @@
1
1
  <script>
2
2
  import svgRaw from '../../images/svg.svg?raw'
3
- import svg from '../../images/svg.svg'
3
+ //import svg from '../../images/svg.svg'
4
4
  import png from '../../images/check-circle-green.png'
5
5
  import Nested from './sub/NestedComponent.svelte'
6
+ import {nestedJavascriptFunction} from '../nestedJavascript.js'
6
7
  export let items
7
8
  let count = 0;
8
9
 
@@ -26,13 +27,15 @@
26
27
  </ul>
27
28
 
28
29
  <hr/>
29
- <p>Images on various ways</p>
30
30
  <span class="wrap-svg">{@html svgRaw}</span>
31
- <img alt="svg ERROR" src={svg} />
31
+ <!-- <img alt="svg ERROR" src={svg} />-->
32
32
  <img alt="png ERROR" src={png} />
33
33
 
34
34
  <hr/>
35
35
  <Nested />
36
+
37
+ <hr/>
38
+ <p>{nestedJavascriptFunction()}</p>
36
39
  </span>
37
40
 
38
41
  <style>
@@ -0,0 +1,3 @@
1
+ export function nestedJavascriptFunction() {
2
+ return 'nestedJavascript!';
3
+ }
@@ -0,0 +1,3 @@
1
+ export function nestedJavascriptFunction() {
2
+ return 'nestedJavascript («toggled»)';
3
+ }
@@ -8,6 +8,23 @@ require 'svelte_on_rails/installer/haml'
8
8
  utils = SvelteOnRails::Installer::Utils
9
9
  npm_i = SvelteOnRails::Installer::Npm
10
10
  application_js_path = Rails.root.join("app", "frontend", "entrypoints", "application.js")
11
+ toggle_hello_world_files = %w[
12
+ app/frontend/images/svg.svg
13
+ app/frontend/images/atom.svg
14
+ app/frontend/javascript/nestedJavascript.js
15
+ app/frontend/javascript/nestedJavascriptToggled.js
16
+ ]
17
+ hello_world_files = %w[
18
+ app/controllers/svelte_on_rails_hello_world_controller.rb
19
+ app/views/svelte_on_rails_hello_world/index.haml
20
+ app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte
21
+ app/frontend/javascript/components/sub/NestedComponent.svelte
22
+ app/frontend/javascript/nestedJavascript.js
23
+ app/frontend/javascript/nestedJavascriptToggled.js
24
+ app/frontend/javascript/components/sub/NestedComponent.svelte
25
+ app/frontend/images/svg.svg
26
+ app/frontend/images/check-circle-green.png
27
+ ]
11
28
 
12
29
  namespace :svelte_on_rails do
13
30
 
@@ -59,7 +76,7 @@ namespace :svelte_on_rails do
59
76
  hello_world_path = nil
60
77
  if utils.ask_yn('Do you want to install the Hello World component?')
61
78
  hw_i = SvelteOnRails::Installer::HelloWorld
62
- hello_world_path = hw_i.install_hello_world
79
+ hello_world_path = hw_i.install_hello_world(hello_world_files)
63
80
  end
64
81
 
65
82
  # finish
@@ -91,7 +108,8 @@ namespace :svelte_on_rails do
91
108
  task :remove_hello_world do
92
109
 
93
110
  hw_i = SvelteOnRails::Installer::HelloWorld
94
- hw_i.remove_hello_world
111
+ f = hello_world_files + toggle_hello_world_files
112
+ hw_i.remove_hello_world(f.uniq)
95
113
 
96
114
  end
97
115
 
@@ -100,7 +118,7 @@ namespace :svelte_on_rails do
100
118
 
101
119
  puts '-' * 80
102
120
  hw_i = SvelteOnRails::Installer::HelloWorld
103
- hello_world_path = hw_i.install_hello_world
121
+ hello_world_path = hw_i.install_hello_world(hello_world_files)
104
122
  puts "You can now see the Hello World component on: #{hello_world_path}."
105
123
 
106
124
  end
@@ -112,23 +130,29 @@ namespace :svelte_on_rails do
112
130
 
113
131
  # write templates
114
132
 
115
- templates = %w[
116
- app/frontend/images/svg.svg
117
- app/frontend/images/atom.svg
118
- ]
119
- utils_i.write_templates(templates, ask_for_overwrite: false)
133
+ utils_i.write_templates(toggle_hello_world_files, ask_for_overwrite: false)
134
+
135
+ puts '+++'
120
136
 
121
137
  toggler = File.expand_path('../svelte_on_rails/installer/rails_template', __dir__) + '/hello_world_toggler'
122
138
  if File.exist?(toggler)
123
139
  File.delete(toggler)
124
140
  File.delete('app/frontend/images/svg.svg')
125
141
  FileUtils.mv('app/frontend/images/atom.svg', 'app/frontend/images/svg.svg')
126
- puts "toggled svg.svg to atom.svg"
142
+ File.delete('app/frontend/javascript/nestedJavascript.js')
143
+ FileUtils.mv('app/frontend/javascript/nestedJavascriptToggled.js', 'app/frontend/javascript/nestedJavascript.js')
144
+ puts "toggled svg.svg and nestedJavascriptToggled.js"
127
145
  else
128
- puts "toggled svg.svg to itself"
146
+ puts "toggled svg.svg and nestedJavascriptToggled.js back to original"
129
147
  FileUtils.touch(toggler)
130
148
  end
131
149
 
150
+ puts '+++'
151
+
152
+ puts "=> The Svelte components are living within the components folder"
153
+ puts "=> The hereby toggled files are outside of the components folder, but within the frontend folder"
154
+ puts "=> this toggling should work because the whole javascript folder is watched for changes (if configured so)"
155
+
132
156
  end
133
157
 
134
158
  desc "Compile all Svelte components"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair
@@ -46,9 +46,10 @@ files:
46
46
  - lib/svelte_on_rails/installer/rails_template/app/frontend/initializers/svelte.js
47
47
  - lib/svelte_on_rails/installer/rails_template/app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte
48
48
  - lib/svelte_on_rails/installer/rails_template/app/frontend/javascript/components/sub/NestedComponent.svelte
49
+ - lib/svelte_on_rails/installer/rails_template/app/frontend/javascript/nestedJavascript.js
50
+ - lib/svelte_on_rails/installer/rails_template/app/frontend/javascript/nestedJavascriptToggled.js
49
51
  - lib/svelte_on_rails/installer/rails_template/app/views/svelte_on_rails_hello_world/index.haml
50
52
  - lib/svelte_on_rails/installer/rails_template/config/svelte_on_rails.yml
51
- - lib/svelte_on_rails/installer/rails_template/hello_world_toggler
52
53
  - lib/svelte_on_rails/installer/svelte.rb
53
54
  - lib/svelte_on_rails/installer/utils.rb
54
55
  - lib/svelte_on_rails/installer/vite.rb