turbo-mount 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +4 -1
- data/lib/generators/turbo_mount/helpers.rb +6 -0
- data/lib/generators/turbo_mount/install_generator.rb +21 -13
- data/lib/turbo/mount/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b29826ddb780be9b604f24aa2a2a4a8635b1dc95106315baeef4323ace52172
|
4
|
+
data.tar.gz: 8f70abb8e1a8a44d26c294f30173b366502e4fe7f6a6e55c4dfe87778f59d883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf7c5d7d5813d7a34137103cee1701ba05400bb3b60e1a5c72da1a261cf4930fa2566c7cba4184740cb4dc0ae91ff28c7ce724d8aca3015b46b807dbe480afa
|
7
|
+
data.tar.gz: 72dd49789b076a28aa63df75a607438998748dd69793dbd2db82d300c4022007e567b88342755aa6212d5402b4be86579c9d50549f2941e436bbdf76600441d1
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.4.1] - 2024-11-26
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Support Shakapacker in the installation script. ([@skryukov])
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Fix installation script interactive mode. ([@skryukov])
|
19
|
+
- Fix installation script dependencies installation. ([@skryukov])
|
20
|
+
|
10
21
|
## [0.4.0] - 2024-11-03
|
11
22
|
|
12
23
|
### Added
|
@@ -82,7 +93,8 @@ and this project adheres to [Semantic Versioning].
|
|
82
93
|
[@jkogara]: https://github.com/jkogara
|
83
94
|
[@skryukov]: https://github.com/skryukov
|
84
95
|
|
85
|
-
[Unreleased]: https://github.com/skryukov/turbo-mount/compare/v0.4.
|
96
|
+
[Unreleased]: https://github.com/skryukov/turbo-mount/compare/v0.4.1...HEAD
|
97
|
+
[0.4.1]: https://github.com/skryukov/turbo-mount/compare/v0.4.0...v0.4.1
|
86
98
|
[0.4.0]: https://github.com/skryukov/turbo-mount/compare/v0.3.3...v0.4.0
|
87
99
|
[0.3.3]: https://github.com/skryukov/turbo-mount/compare/v0.3.2...v0.3.3
|
88
100
|
[0.3.2]: https://github.com/skryukov/turbo-mount/compare/v0.3.1...v0.3.2
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<
|
2
|
+
<picture>
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
|
4
|
+
<img src="assets/logo.svg" title="Turbo Mount logo" width="220" height="45">
|
5
|
+
</picture>
|
3
6
|
</p>
|
4
7
|
|
5
8
|
<h1 align="center">Turbo Mount</h1>
|
@@ -20,6 +20,8 @@ module TurboMount
|
|
20
20
|
def js_entrypoint
|
21
21
|
if vite?
|
22
22
|
js_file_path "entrypoints/application.js"
|
23
|
+
elsif shakapacker?
|
24
|
+
js_file_path "packs/application.js"
|
23
25
|
else
|
24
26
|
js_file_path "application.js"
|
25
27
|
end
|
@@ -41,6 +43,10 @@ module TurboMount
|
|
41
43
|
file?("config/vite.json") && Dir.glob(file_path("vite.config.*")).any?
|
42
44
|
end
|
43
45
|
|
46
|
+
def shakapacker?
|
47
|
+
file?("config/shakapacker.yml") || file?("config/webpacker.yml")
|
48
|
+
end
|
49
|
+
|
44
50
|
# Interactivity Helpers
|
45
51
|
def ask(*)
|
46
52
|
unless options[:interactive]
|
@@ -25,6 +25,9 @@ module TurboMount
|
|
25
25
|
enum: JSPackageManager.package_managers,
|
26
26
|
desc: "The package manager you want to use to install Turbo Mount"
|
27
27
|
|
28
|
+
class_option :interactive, type: :boolean, default: true,
|
29
|
+
desc: "Whether to prompt for optional installations"
|
30
|
+
|
28
31
|
class_option :verbose, type: :boolean, default: false,
|
29
32
|
desc: "Run the generator in verbose mode"
|
30
33
|
|
@@ -33,6 +36,7 @@ module TurboMount
|
|
33
36
|
|
34
37
|
package_manager.validate!
|
35
38
|
|
39
|
+
create_initializer
|
36
40
|
if package_manager.importmap?
|
37
41
|
install_importmap
|
38
42
|
else
|
@@ -44,35 +48,39 @@ module TurboMount
|
|
44
48
|
|
45
49
|
private
|
46
50
|
|
47
|
-
def
|
48
|
-
package_manager.add_dependencies("turbo-mount", FRAMEWORKS[framework][:npm_packages])
|
49
|
-
|
51
|
+
def create_initializer
|
50
52
|
say "Creating Turbo Mount initializer"
|
51
|
-
|
53
|
+
|
54
|
+
needs_alias = shakapacker? || package_manager.importmap?
|
55
|
+
initializer_path = needs_alias ? "turbo-mount-initializer.js" : "turbo-mount.js"
|
56
|
+
initializer_import = needs_alias ? %(import "turbo-mount-initializer"\n) : %(import "./turbo-mount"\n)
|
57
|
+
|
58
|
+
template "turbo-mount.js", js_file_path(initializer_path)
|
52
59
|
begin
|
53
|
-
append_to_file js_entrypoint,
|
60
|
+
append_to_file js_entrypoint, initializer_import
|
54
61
|
rescue
|
55
|
-
say
|
62
|
+
say "Could not find the application entrypoint, please add `#{initializer_import.strip}` manually.", :yellow
|
56
63
|
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def install_nodejs
|
67
|
+
package_manager.add_dependencies("turbo-mount", FRAMEWORKS[framework]["npm_packages"])
|
68
|
+
|
57
69
|
warn_about_vite_plugin if vite?
|
58
70
|
end
|
59
71
|
|
60
72
|
def install_importmap
|
61
|
-
say "Creating Turbo Mount initializer"
|
62
|
-
template "turbo-mount.js", js_file_path("turbo-mount-initializer.js")
|
63
|
-
append_to_file "app/javascript/application.js", %(import "turbo-mount-initializer"\n)
|
64
|
-
|
65
73
|
say "Pinning Turbo Mount to the importmap"
|
66
74
|
append_to_file "config/importmap.rb", %(pin "turbo-mount", to: "turbo-mount.min.js"\n)
|
67
75
|
append_to_file "config/importmap.rb", %(pin "turbo-mount/#{framework}", to: "turbo-mount/#{framework}.min.js"\n)
|
68
76
|
append_to_file "config/importmap.rb", %(pin "turbo-mount-initializer"\n)
|
69
77
|
|
70
78
|
say "Pinning framework dependencies to the importmap"
|
71
|
-
package_manager.add_dependencies(FRAMEWORKS[framework][
|
79
|
+
package_manager.add_dependencies(FRAMEWORKS[framework]["pins"])
|
72
80
|
end
|
73
81
|
|
74
82
|
def warn_about_vite_plugin
|
75
|
-
say "Make sure to install and add #{FRAMEWORKS[framework][
|
83
|
+
say "Make sure to install and add #{FRAMEWORKS[framework]["vite_plugin"]} to your Vite config", :yellow
|
76
84
|
end
|
77
85
|
|
78
86
|
def package_manager
|
@@ -80,7 +88,7 @@ module TurboMount
|
|
80
88
|
end
|
81
89
|
|
82
90
|
def extension
|
83
|
-
FRAMEWORKS[framework][
|
91
|
+
FRAMEWORKS[framework]["extension"]
|
84
92
|
end
|
85
93
|
|
86
94
|
def framework
|
data/lib/turbo/mount/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-mount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svyatoslav Kryukov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
rubygems_version: 3.5.
|
87
|
+
rubygems_version: 3.5.23
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Use React, Vue, Svelte, and other components with Hotwire.
|