svelte-on-rails 0.0.41 → 0.0.42
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/README.md +13 -10
- data/lib/svelte_on_rails/installer/npm.rb +1 -1
- data/lib/svelte_on_rails/lib/development_utils.rb +24 -11
- data/lib/tasks/svelte_on_rails_tasks.rake +27 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c46f6cb43c90617bc4798072b58a35e81a311886a858c379224216fc63c03d3e
|
4
|
+
data.tar.gz: 2bd3286eac9420225ac3f641d1cf783a84f48f575d69c0bce53a9b1da9d9d262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e4ae887620aaabd737fc30864bed6eea15dcc9bb47e6ef9db4ab1e38f0ea96a1643b2f12cd81aeadf2c636e6e1575920da2efca62886e877a71dbe25b2818a2
|
7
|
+
data.tar.gz: 821084886d515faf8e68440a001bc4a3fd5d310c6068efbb1578ca558774f0ad731e5cf13f142b3223db7e5a2b380775319de9ce3e75a54e597ff59ba1a505cc
|
data/README.md
CHANGED
@@ -263,10 +263,20 @@ Example from the rails console for a medium complex component
|
|
263
263
|
|
264
264
|
## Contributors Guide
|
265
265
|
|
266
|
-
|
266
|
+
Contributors welcome!
|
267
|
+
|
268
|
+
After downloaded the gem, please run the task
|
269
|
+
|
270
|
+
```bash
|
271
|
+
rake svelte_on_rails:create_contributor_configs_file
|
272
|
+
```
|
273
|
+
and define a `generated_test_app_folder_path` (required) for apps, generated for the testings.
|
267
274
|
|
268
|
-
|
269
|
-
|
275
|
+
For development of the **npm package @csedl/svelte-on-rails** you can set the
|
276
|
+
`local_npm_package_path` (optional) and insert the path to the npm package on your local machine.
|
277
|
+
This will cause the installer, to install the npm package from a local path instead from the npm registry.
|
278
|
+
|
279
|
+
Tests are based on the included templates, like the `hello world template` and on the installer.
|
270
280
|
|
271
281
|
**Installer tests** starting with completely destroy the rails app within the `generated_test_app_path`,
|
272
282
|
generating a new rails app and running the installer and test by `playwright` if the components are working.
|
@@ -293,13 +303,6 @@ The current test cases including (among others):
|
|
293
303
|
create a completely new rails app, running the full installer and check if a hello World component is visible and javascript is working.
|
294
304
|
run assets:precompile within a rails app and check if the gem does its precompiling too.
|
295
305
|
|
296
|
-
For development of the **npm package @csedl/svelte-on-rails** you can add the file
|
297
|
-
`local_npm_package_path` and insert the path to the npm package on your local machine.
|
298
|
-
This will cause the installer, not to install the npm package from npm, but to use the local one.
|
299
|
-
|
300
|
-
‼️ **ATTENTION:** Please do never commit the file `local_npm_package_path` to the repo! This is only for developers!
|
301
|
-
Otherwise a user would, on running the installer, get an error, because the npm package is not found.
|
302
|
-
|
303
306
|
## Licence
|
304
307
|
|
305
308
|
License is MIT
|
@@ -2,18 +2,15 @@ module SvelteOnRails
|
|
2
2
|
class DevelopmentUtils
|
3
3
|
|
4
4
|
def self.local_npm_package_url
|
5
|
-
|
6
|
-
if !
|
7
|
-
|
5
|
+
str = contributor_config('local_npm_package_path', required: false)
|
6
|
+
if !str.present?
|
7
|
+
nil
|
8
|
+
elsif !Dir.exist?(str)
|
9
|
+
raise "Invalid path given on local_npm_package_path: «#{str}»"
|
10
|
+
elsif !File.exist?(Pathname.new(str).join('package.json'))
|
11
|
+
raise "Given local_npm_package_path does not seem to be a valid npm package as it does not contain a package.json"
|
8
12
|
else
|
9
|
-
|
10
|
-
if !Dir.exist?(str)
|
11
|
-
raise "Invalid path given on local_npm_package_path: «#{str}»"
|
12
|
-
elsif !File.exist?(Pathname.new(str).join('package.json'))
|
13
|
-
raise "Given local_npm_package_path does not seem to be a valid npm package as it does not contain a package.json"
|
14
|
-
else
|
15
|
-
return Pathname.new(str)
|
16
|
-
end
|
13
|
+
return Pathname.new(str)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
|
@@ -21,5 +18,21 @@ module SvelteOnRails
|
|
21
18
|
Pathname.new(File.expand_path('../../..', __dir__))
|
22
19
|
end
|
23
20
|
|
21
|
+
def self.contributor_config(key, required: true)
|
22
|
+
config_file = File.expand_path('../svelte_on_rails_contributor_configs.yml', gem_folder)
|
23
|
+
if !File.exist?(config_file)
|
24
|
+
if required
|
25
|
+
raise "Missing configuration file, searched at: «#{config_file}»"
|
26
|
+
end
|
27
|
+
else
|
28
|
+
yml = YAML.load_file(config_file)
|
29
|
+
value = yml[key.to_s]
|
30
|
+
if required && !value.present?
|
31
|
+
raise "Missing value «#{key}» in configuration file: «#{config_file}»"
|
32
|
+
end
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
24
37
|
end
|
25
38
|
end
|
@@ -71,4 +71,31 @@ namespace :svelte_on_rails do
|
|
71
71
|
SvelteOnRails::Compiler.reset_and_compile_all
|
72
72
|
end
|
73
73
|
|
74
|
+
desc "For contributors to this gem: writes a config file for developing options."
|
75
|
+
task :create_contributor_configs_file do
|
76
|
+
path = File.expand_path('../../../svelte_on_rails_contributor_configs.yml', __dir__)
|
77
|
+
|
78
|
+
if File.exist?(path)
|
79
|
+
puts "Config file for Contributors already exists: file://#{path}"
|
80
|
+
puts 'nothing done.'
|
81
|
+
exit
|
82
|
+
end
|
83
|
+
|
84
|
+
content = <<-END
|
85
|
+
#local_npm_package_path: /path/to/my/local/csedl-svelte-on-rails-main
|
86
|
+
|
87
|
+
# optional
|
88
|
+
# If you want to develop the @csedl/svelte-on-rails package
|
89
|
+
# add full path like /path/to/csedl-svelte-on-rails-main
|
90
|
+
# Then, on running the generator, it installs this package from your local root folder
|
91
|
+
|
92
|
+
generated_test_app_folder_path: /destination/folder/for/generated/test/app
|
93
|
+
|
94
|
+
# required!
|
95
|
+
# When you run tests, a rails app will be generated into this folder
|
96
|
+
END
|
97
|
+
File.write(path, content)
|
98
|
+
puts "Config file for Contributors created at: #{path}"
|
99
|
+
end
|
100
|
+
|
74
101
|
end
|