svelte-on-rails 1.0.9 → 1.0.11

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: cb655acf835569ad78c9e3b15a1604b0d77bb677bd915bbd6ca8f5f5fa49e77b
4
- data.tar.gz: edd7611ff43cfa65f947d787731cbdece2a217220a8c932e242cbfa0dcb208ef
3
+ metadata.gz: 11f044fdee86f5acc0dc592039acf158004a9f9849caaf12aaddbfaf16c7a086
4
+ data.tar.gz: '036408c99291e0a454726e0624a8492de97936e70550936fa5b49f670893bfcb'
5
5
  SHA512:
6
- metadata.gz: 7ff325ca84c415ec46469c6679ecf6c2e26f149a2f49d4094995f273da049e501618c1c3e2c1ba2b5b70419b60652fefbcc8c6e318cd6028a386b6aa1e8d11ef
7
- data.tar.gz: 006ce4b8ff255bbed32abacac056381443e1a2ddaae719797935787d814102224e37e4c4e928e97038e60da19c79dea44069864bfba9e3316f157afe0add0d11
6
+ metadata.gz: 21235c147c880a84db9ad123aea60e5d9833e0451675754f9e6ac94c395fa445182e69fe1fbce6b1caf09c7e4e5c84fd7fa2a0460d5e9fe18d55fb9384287a58
7
+ data.tar.gz: 6673e550b9afc250663c81cdeca7837e4a8649875a4541cb83dabd773544fc528c52787b447d28c7d356ea664b3f1a8b911f6c864d1814e032830f73bc7c0305
data/README.md CHANGED
@@ -34,6 +34,10 @@ This all fits perfectly with the Rails way of minimalist javascript, but: Where
34
34
  - 🤝 fully integrated with `assets:precompile`
35
35
  - 🚀 cero-config deployment
36
36
 
37
+ # Known Issues
38
+
39
+ see [issues](https://gitlab.com/sedl/svelte-on-rails/-/issues)
40
+
37
41
  # Svelte on Rails 👍
38
42
 
39
43
  Rock-solid and seamless integration of Svelte Components into Rails views, based on `vite_rails`.
@@ -51,8 +55,8 @@ Thanks to [shakacode](https://github.com/shakacode/react_on_rails)
51
55
  and [ElMassimo](https://github.com/ElMassimo) for inspiring and helping me with their gems.
52
56
 
53
57
  **STATUS** This gem is in early development but ready to use for curious developers.
54
- It has a 100% test coverage, all tests pass.
55
- It is not yet implemented on my customer projects, but this will follow soon.
58
+ It has a nearly 100% test coverage, all tests pass and, since 2025-05-15 it is successfully
59
+ implemented on my first customers app.
56
60
 
57
61
  If you have issues, please open one, and contributors are welcome!
58
62
 
@@ -68,8 +72,6 @@ If you have issues, please open one, and contributors are welcome!
68
72
 
69
73
  ## Installation from cero ⚙️
70
74
 
71
- With haml, vite, svelte and turbo:
72
-
73
75
  ```bash
74
76
  rails new my-test-app --skip-javascript
75
77
  ```
@@ -88,7 +90,7 @@ rails g svelte_on_rails:install --full
88
90
 
89
91
  You have done it! 👍
90
92
 
91
- Restart the server and you will see a svelte hello world component rendered on the browser.
93
+ Start the server and you will see a svelte hello world component rendered on the browser.
92
94
 
93
95
  **Explanation:**
94
96
 
@@ -164,11 +166,12 @@ And you should see your component rendered on the browser! 👍 🤗
164
166
 
165
167
  this Minimal installer does:
166
168
 
167
- - `app/frontend/initializers/svelte.js`
169
+ - add `app/frontend/initializers/svelte.js`
168
170
  - Adds a import statement for that initializer to `application.js`
169
- - `app/frontend/ssr/ssr.js`
170
- - `config/svelte_on_rails.yml`
171
- - `vite-ssr.config.ts`
171
+ - add `app/frontend/ssr/ssr.js`
172
+ - add `config/svelte_on_rails.yml`
173
+ - add `vite-ssr.config.ts`
174
+ - add command `npm run build:ssr` to package.json
172
175
  - installs or updates npm packages to the latest:
173
176
  - `@csedl/svelte-on-rails`
174
177
  - `typescript`
@@ -58,15 +58,23 @@ module SvelteOnRails
58
58
 
59
59
  def self.precompile(last_mtime = nil)
60
60
  config = SvelteOnRails::Configuration.instance
61
+
62
+ mtime = (File.exist?(config.ssr_dist_folder.join('last_mtime')) ? File.read(config.ssr_dist_folder.join('last_mtime')).to_f : 0.0)
63
+
61
64
  Dir.chdir(config.rails_root) do
62
65
  cmd = "./node_modules/.bin/vite build --config vite-ssr.config.ts"
63
66
  stdout, stderr, status = Open3.capture3(cmd)
67
+ mtime2 = (File.exist?(config.ssr_dist_folder.join('last_mtime')) ? File.read(config.ssr_dist_folder.join('last_mtime')).to_f : 0.0)
68
+ build_failed = mtime2 == mtime
69
+ color = (build_failed ? "\033[97;41m" : "\033[30;106m")
64
70
 
65
71
  if stderr.present?
66
- msg = " +++ ERROR compiling Svelte components («#{cmd}») +++ "
67
- puts "\033[97;41m#{msg}\033[0m"
68
- puts stderr
69
- puts "\033[97;41m +++ End of error message +++ \033[0m"
72
+ msg = " +++ #{build_failed ? 'ERROR' : 'WARNING'} compiling Svelte components#{build_failed ? ' failed' : ''} («#{cmd}») +++ "
73
+ puts "#{color}#{msg}\033[0m"
74
+ errs = stderr.split("\n")
75
+ errs.each {|e|puts "#{color} \033[0m #{e}"}
76
+ puts "#{color} +++ End of error message +++ \033[0m"
77
+ puts "#{color} +++ Run «npm run build:ssr» on the console to see the original error message +++ \033[0m"
70
78
  end
71
79
  puts stdout
72
80
 
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: 1.0.9
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair