avo 2.14.2 → 2.14.3.pre.3.jsbundling
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/app/javascript/{avo.js → avo.base.js} +0 -0
- data/app/views/layouts/avo/application.html.erb +2 -2
- data/config/master.key +1 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/js/install_generator.rb +64 -0
- data/lib/generators/avo/templates/js/avo.custom.js +2 -0
- data/public/avo-assets/{avo.js → avo.base.js} +1 -1
- data/public/avo-assets/{avo.js.map → avo.base.js.map} +1 -1
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ede274df957fa28cce74c79aee056b2e7da626cb5db843647cb56f3eeef8222
|
4
|
+
data.tar.gz: 5401228e96ad20d0e5d2e97937d8c83d135bdc666e7cf173166dd5b0d8c03ca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4d2ac6b2011ddfd4dd8a6c699499dae18b6d3dbdfafaf31f2a27995f7c5d0301fa9b9e1927bba0efa16cc7207679265751500f07dfec247abfde869922b783
|
7
|
+
data.tar.gz: 0c7f1c148088882099d1c5f0c197b16232fa4f9300d6c422ad8db6fcd731b9386c9a1d3db29ab8dd7a588c3539a821e274afce051aaec87f6d1c8816865d265b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (2.14.
|
4
|
+
avo (2.14.3.pre.3.jsbundling)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -256,6 +256,8 @@ GEM
|
|
256
256
|
nokogiri (1.13.7)
|
257
257
|
mini_portile2 (~> 2.8.0)
|
258
258
|
racc (~> 1.4)
|
259
|
+
nokogiri (1.13.7-x86_64-linux)
|
260
|
+
racc (~> 1.4)
|
259
261
|
orm_adapter (0.5.0)
|
260
262
|
pagy (5.10.1)
|
261
263
|
activesupport
|
File without changes
|
@@ -8,10 +8,10 @@
|
|
8
8
|
<%= render partial: 'avo/partials/javascript' %>
|
9
9
|
<%= render partial: 'avo/partials/head' %>
|
10
10
|
<% if Avo::PACKED %>
|
11
|
-
<%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
11
|
+
<%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
|
12
12
|
<%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
13
13
|
<% else %>
|
14
|
-
<%= javascript_include_tag "avo", "data-turbo-track": "reload", defer: true %>
|
14
|
+
<%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
|
15
15
|
<%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
|
16
16
|
<% if Rails.env.development? %>
|
17
17
|
<%= javascript_include_tag "hotwire-livereload", defer: true %>
|
data/config/master.key
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2aeb23d82b909d9c6b5abb62f7058c2a
|
data/lib/avo/version.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative "../base_generator"
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
module Avo
|
5
|
+
module Js
|
6
|
+
class InstallGenerator < BaseGenerator
|
7
|
+
source_root File.expand_path("../templates", __dir__)
|
8
|
+
|
9
|
+
namespace "avo:js:install"
|
10
|
+
desc "Add custom JavaScript assets to your Avo project."
|
11
|
+
|
12
|
+
# possible values: importmap or esbuild
|
13
|
+
class_option :bundler, type: :string, default: "importmap"
|
14
|
+
|
15
|
+
def create_files
|
16
|
+
case options[:bundler].to_s
|
17
|
+
when "importmap"
|
18
|
+
install_for_importmap
|
19
|
+
when "esbuild"
|
20
|
+
install_for_esbuild
|
21
|
+
else
|
22
|
+
say "We don't know how to install Avo JS for this bundler \"#{options[:bundler]}\""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
no_tasks do
|
27
|
+
def install_for_importmap
|
28
|
+
unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
|
29
|
+
say "Add default app/javascript/avo.custom.js"
|
30
|
+
copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
|
31
|
+
end
|
32
|
+
|
33
|
+
say "Ejecting the _head.html.erb partial"
|
34
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
35
|
+
|
36
|
+
say "Adding the JS asset to the partial"
|
37
|
+
append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_importmap_tags \"avo.custom\" %>"
|
38
|
+
|
39
|
+
# pin to importmap
|
40
|
+
say "Pin the new entrypoint to your importmap config"
|
41
|
+
append_to_file Rails.root.join("config", "importmap.rb"), "\n# Avo custom JS entrypoint\npin \"avo.custom\", preload: true\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
def install_for_esbuild
|
45
|
+
unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
|
46
|
+
say "Add default app/javascript/avo.custom.js"
|
47
|
+
copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
|
48
|
+
end
|
49
|
+
|
50
|
+
say "Ejecting the _head.html.erb partial"
|
51
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
52
|
+
|
53
|
+
say "Adding the JS asset to the partial"
|
54
|
+
append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_include_tag \"avo.custom\", \"data-turbo-track\": \"reload\", defer: true %>"
|
55
|
+
end
|
56
|
+
|
57
|
+
def template_path(filename)
|
58
|
+
Pathname.new(__dir__).join("..", "templates", "js", filename).to_s
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -510,4 +510,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
510
510
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
511
511
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
512
512
|
*/
|
513
|
-
//# sourceMappingURL=avo.js.map
|
513
|
+
//# sourceMappingURL=avo.base.js.map
|