avo 4.0.0.beta.10 → 4.0.0.beta.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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/application.css +0 -10
- data/app/controllers/avo/base_application_controller.rb +5 -2
- data/app/views/layouts/avo/application.html.erb +0 -3
- data/lib/avo/engine.rb +0 -4
- data/lib/avo/tailwind_builder.rb +71 -49
- data/lib/avo/version.rb +1 -1
- data/lib/tasks/avo_tasks.rake +9 -6
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '01000813767705fb54b1c2f153307ed34c57d868b1dda2584b54232e803214fe'
|
|
4
|
+
data.tar.gz: 57c69067ea0028edc7bfccc2818273a85fe984303e22088a7c5bb4f909232fd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a57bf48232fc5bd63e5b2438fc1b95f49063f69b29afe139e1455390516e07a2dff07cf42954ccbdfbba7ca4d61b8feb1343e73e74f0cdd27b6b448614247be4
|
|
7
|
+
data.tar.gz: f2d4cde61824ce1693361009129f6b96984f443408693400a81ca1b0406236b8792f1b539e0528cb0191cf03aa1e9317f3d75324c5ee5f9314e5b080ed846feb
|
data/Gemfile.lock
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/* @layer base, components, utilities; */
|
|
2
2
|
@import "tailwindcss";
|
|
3
3
|
|
|
4
|
-
/* TODO: Figure out a way to add those dynamically */
|
|
5
|
-
@source "../../../tmp/avo/packages/avo-advanced";
|
|
6
|
-
@source "../../../tmp/avo/packages/avo-dashboards";
|
|
7
|
-
@source "../../../tmp/avo/packages/avo-dynamic_filters";
|
|
8
|
-
@source "../../../tmp/avo/packages/avo-kanban";
|
|
9
|
-
@source "../../../tmp/avo/packages/avo-menu";
|
|
10
|
-
@source "../../../tmp/avo/packages/avo-pro";
|
|
11
|
-
@source "../../../tmp/avo/packages/avo-forms";
|
|
12
|
-
|
|
13
|
-
/* @config "../../../tailwind.config.js"; */
|
|
14
4
|
|
|
15
5
|
/* We couldn't find a way to implement blocklist in the CSS config */
|
|
16
6
|
/* blocklist: ['bg-[#{chart_color(index)}]', 'bg-[${color}]'] */
|
|
@@ -296,8 +296,11 @@ module Avo
|
|
|
296
296
|
end
|
|
297
297
|
|
|
298
298
|
def set_stylesheet_assets_path
|
|
299
|
-
@stylesheet_assets_path =
|
|
300
|
-
|
|
299
|
+
@stylesheet_assets_path = if Avo::TailwindBuilder.custom_build_exists?
|
|
300
|
+
"avo.tailwind"
|
|
301
|
+
else
|
|
302
|
+
"avo/application"
|
|
303
|
+
end
|
|
301
304
|
end
|
|
302
305
|
|
|
303
306
|
def choose_layout
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
<%= render partial: "avo/partials/pre_head" %>
|
|
19
19
|
<%= render Avo::AssetManager::StylesheetComponent.new asset_manager: Avo.asset_manager %>
|
|
20
20
|
<%= stylesheet_link_tag @stylesheet_assets_path, "data-turbo-track": "reload", as: "style" %>
|
|
21
|
-
<% if @custom_stylesheet_path %>
|
|
22
|
-
<%= stylesheet_link_tag @custom_stylesheet_path, "data-turbo-track": "reload", as: "style" %>
|
|
23
|
-
<% end %>
|
|
24
21
|
|
|
25
22
|
<%= javascript_include_tag "avo/application", "data-turbo-track": "reload", defer: true %>
|
|
26
23
|
|
data/lib/avo/engine.rb
CHANGED
|
@@ -55,10 +55,6 @@ module Avo
|
|
|
55
55
|
rescue StandardError => e
|
|
56
56
|
Rails.logger.warn "Avo: Failed to auto-build Tailwind CSS: #{e.message}"
|
|
57
57
|
end
|
|
58
|
-
|
|
59
|
-
unless Avo::TailwindBuilder.procfile_has_avo_tailwind_watcher?
|
|
60
|
-
Rails.logger.info "Avo: For live Tailwind CSS reload in development, add to Procfile.dev: avo_css: bin/rails avo:tailwindcss:watch"
|
|
61
|
-
end
|
|
62
58
|
end
|
|
63
59
|
end
|
|
64
60
|
|
data/lib/avo/tailwind_builder.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "fileutils"
|
|
2
|
+
require "pathname"
|
|
2
3
|
|
|
3
4
|
module Avo
|
|
4
5
|
class TailwindBuilder
|
|
@@ -23,16 +24,11 @@ module Avo
|
|
|
23
24
|
Rails.root.join("app", "assets", "builds", "avo.tailwind.css").exist?
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
def self.procfile_has_avo_tailwind_watcher?
|
|
27
|
-
path = Rails.root.join("Procfile.dev")
|
|
28
|
-
return false unless path.exist?
|
|
29
|
-
|
|
30
|
-
File.read(path).include?("avo:tailwindcss")
|
|
31
|
-
end
|
|
32
|
-
|
|
33
27
|
def build
|
|
34
28
|
return true unless self.class.tailwindcss_available?
|
|
35
29
|
|
|
30
|
+
ensure_node_modules
|
|
31
|
+
run_engine_css_prebuilds
|
|
36
32
|
generate_input_file
|
|
37
33
|
success = run_tailwindcss("--minify")
|
|
38
34
|
log_build_failure unless success
|
|
@@ -40,33 +36,44 @@ module Avo
|
|
|
40
36
|
end
|
|
41
37
|
|
|
42
38
|
def watch
|
|
43
|
-
return unless self.class.tailwindcss_available?
|
|
39
|
+
return true unless self.class.tailwindcss_available?
|
|
44
40
|
|
|
41
|
+
ensure_node_modules
|
|
42
|
+
run_engine_css_prebuilds
|
|
45
43
|
generate_input_file
|
|
46
|
-
|
|
44
|
+
run_tailwindcss("--watch")
|
|
45
|
+
end
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def run_engine_css_prebuilds
|
|
50
|
+
roots = [Avo::Engine.root] + Avo.plugin_manager.engines.map { |e| e[:klass]&.root }.compact
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_, status = Process.waitpid2(pid, Process::WNOHANG)
|
|
53
|
-
break if status
|
|
52
|
+
roots.uniq.each do |root|
|
|
53
|
+
next unless root.directory?
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
signature = new_signature
|
|
58
|
-
generate_input_file
|
|
59
|
-
end
|
|
55
|
+
prebuild = root.join("bin", "prebuild_css")
|
|
56
|
+
next unless prebuild.exist?
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
Dir.chdir(root) do
|
|
59
|
+
Kernel.system("ruby", prebuild.to_s)
|
|
62
60
|
end
|
|
63
|
-
rescue Interrupt
|
|
64
|
-
Process.kill("TERM", pid)
|
|
65
|
-
raise
|
|
66
61
|
end
|
|
67
62
|
end
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
def ensure_node_modules
|
|
65
|
+
engine_root = Avo::Engine.root
|
|
66
|
+
package_json = engine_root.join("package.json")
|
|
67
|
+
node_modules = engine_root.join("node_modules")
|
|
68
|
+
|
|
69
|
+
return unless package_json.exist?
|
|
70
|
+
return if node_modules.directory?
|
|
71
|
+
|
|
72
|
+
# Avo's stylesheet imports include CSS from npm packages. When running from source (or in some
|
|
73
|
+
# packaging setups), `node_modules/` may not exist yet, so Tailwind's CSS resolver fails.
|
|
74
|
+
success = Dir.chdir(engine_root) { Kernel.system("yarn", "install", "--frozen-lockfile") }
|
|
75
|
+
warn "[Avo] `yarn install` failed; Tailwind build may fail." unless success
|
|
76
|
+
end
|
|
70
77
|
|
|
71
78
|
def tmp_input_dir
|
|
72
79
|
Rails.root.join("tmp", "avo")
|
|
@@ -84,14 +91,12 @@ module Avo
|
|
|
84
91
|
FileUtils.mkdir_p(tmp_input_dir)
|
|
85
92
|
|
|
86
93
|
lines = []
|
|
87
|
-
# Input lives under tmp/avo/; without
|
|
94
|
+
# Input lives under tmp/avo/; without `@source "../../"` Tailwind v4 only scans near this file, so
|
|
88
95
|
# classes in app/views/**/*.erb (and the rest of the app) are never detected.
|
|
89
|
-
lines << %(@
|
|
90
|
-
|
|
91
|
-
lines << %(@import "tailwindcss/theme.css" layer(theme);)
|
|
92
|
-
lines << %(@import "tailwindcss/utilities.css" layer(utilities);)
|
|
96
|
+
lines << %(@import "tailwindcss";)
|
|
93
97
|
lines << %(@source "../../";)
|
|
94
|
-
|
|
98
|
+
|
|
99
|
+
append_plugin_engine_tailwind_sources(lines)
|
|
95
100
|
collect_host_avo_stylesheets.each do |path|
|
|
96
101
|
lines << %(@import "#{path}";)
|
|
97
102
|
end
|
|
@@ -99,6 +104,41 @@ module Avo
|
|
|
99
104
|
File.write(input_path, lines.join("\n") + "\n")
|
|
100
105
|
end
|
|
101
106
|
|
|
107
|
+
def append_plugin_engine_tailwind_sources(lines)
|
|
108
|
+
# Include Avo itself (the core engine) in Tailwind's scan paths.
|
|
109
|
+
lines << %(@source "#{relative_to_tmp(Avo::Engine.root)}";)
|
|
110
|
+
append_engine_stylesheets(lines, Avo::Engine.root)
|
|
111
|
+
|
|
112
|
+
Avo.plugin_manager.engines.each do |entry|
|
|
113
|
+
root = entry[:klass].root
|
|
114
|
+
next unless root&.directory?
|
|
115
|
+
|
|
116
|
+
lines << %(@source "#{relative_to_tmp(root)}";)
|
|
117
|
+
append_engine_stylesheets(lines, root)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def append_engine_stylesheets(lines, engine_root)
|
|
122
|
+
stylesheets_root = engine_root.join("app", "assets", "stylesheets")
|
|
123
|
+
return unless stylesheets_root.directory?
|
|
124
|
+
|
|
125
|
+
# Some engines ship `app/assets/stylesheets/application.css` directly (no namespace folder).
|
|
126
|
+
root_application = stylesheets_root.join("application.css")
|
|
127
|
+
lines << %(@import "#{relative_to_tmp(root_application)}";) if root_application.exist?
|
|
128
|
+
|
|
129
|
+
# Most engines namespace their assets under `app/assets/stylesheets/<namespace>/application.css`.
|
|
130
|
+
Dir.children(stylesheets_root).sort.each do |entry|
|
|
131
|
+
next if entry.start_with?(".")
|
|
132
|
+
|
|
133
|
+
namespaced_application = stylesheets_root.join(entry, "application.css")
|
|
134
|
+
lines << %(@import "#{relative_to_tmp(namespaced_application)}";) if namespaced_application.exist?
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def relative_to_tmp(absolute)
|
|
139
|
+
Pathname.new(absolute).expand_path.relative_path_from(tmp_input_dir.expand_path).to_s.tr("\\", "/")
|
|
140
|
+
end
|
|
141
|
+
|
|
102
142
|
def collect_host_avo_stylesheets
|
|
103
143
|
base = Rails.root.join("app", "assets", "stylesheets", "avo")
|
|
104
144
|
return [] unless Dir.exist?(base)
|
|
@@ -107,11 +147,7 @@ module Avo
|
|
|
107
147
|
.glob(base.join("**", "*.css"))
|
|
108
148
|
.select { |path| File.file?(path) }
|
|
109
149
|
.sort
|
|
110
|
-
.map { |path|
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def host_avo_stylesheets_signature
|
|
114
|
-
collect_host_avo_stylesheets.join("\n")
|
|
150
|
+
.map { |path| relative_to_tmp(path) }
|
|
115
151
|
end
|
|
116
152
|
|
|
117
153
|
def run_tailwindcss(*args)
|
|
@@ -129,20 +165,6 @@ module Avo
|
|
|
129
165
|
end
|
|
130
166
|
end
|
|
131
167
|
|
|
132
|
-
def spawn_tailwindcss(*args)
|
|
133
|
-
require "tailwindcss/ruby"
|
|
134
|
-
|
|
135
|
-
FileUtils.mkdir_p(output_path.dirname)
|
|
136
|
-
|
|
137
|
-
Process.spawn(
|
|
138
|
-
Tailwindcss::Ruby.executable,
|
|
139
|
-
"-i", input_path.to_s,
|
|
140
|
-
"-o", output_path.to_s,
|
|
141
|
-
*args,
|
|
142
|
-
chdir: Rails.root.to_s
|
|
143
|
-
)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
168
|
def log_build_failure
|
|
147
169
|
message = "[Avo] avo:tailwindcss build failed."
|
|
148
170
|
Rails.logger.warn(message) if defined?(Rails) && Rails.logger
|
data/lib/avo/version.rb
CHANGED
data/lib/tasks/avo_tasks.rake
CHANGED
|
@@ -98,10 +98,10 @@ task "avo:yarn_install" do
|
|
|
98
98
|
`yarn add tailwindcss@^4.0.0 @tailwindcss/typography@^0.5.16 @tailwindcss/container-queries@^0.1.1 --cwd #{Avo::Engine.root}`
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
desc "Build Avo custom Tailwind CSS"
|
|
101
|
+
desc "Build Avo custom Tailwind CSS (requires tailwindcss-ruby gem; outputs app/assets/builds/avo.tailwind.css)"
|
|
102
102
|
task "avo:tailwindcss:build" => :environment do
|
|
103
103
|
unless Avo::TailwindBuilder.tailwindcss_available?
|
|
104
|
-
puts "[Avo->] tailwindcss-
|
|
104
|
+
puts "[Avo->] tailwindcss-ruby not found; skipping avo:tailwindcss:build"
|
|
105
105
|
next
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -111,12 +111,15 @@ task "avo:tailwindcss:build" => :environment do
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
desc "Watch
|
|
114
|
+
desc "Watch Avo custom Tailwind CSS (requires tailwindcss-ruby gem; outputs app/assets/builds/avo.tailwind.css)"
|
|
115
115
|
task "avo:tailwindcss:watch" => :environment do
|
|
116
116
|
unless Avo::TailwindBuilder.tailwindcss_available?
|
|
117
|
-
|
|
117
|
+
puts "[Avo->] tailwindcss-ruby not found; skipping avo:tailwindcss:watch"
|
|
118
|
+
next
|
|
118
119
|
end
|
|
119
120
|
|
|
120
|
-
puts "[Avo->] Watching Avo Tailwind CSS extension..."
|
|
121
|
-
Avo::TailwindBuilder.watch
|
|
121
|
+
puts "[Avo->] Watching Avo Tailwind CSS extension (avo.tailwind)..."
|
|
122
|
+
unless Avo::TailwindBuilder.watch
|
|
123
|
+
abort "[Avo->] avo:tailwindcss:watch failed"
|
|
124
|
+
end
|
|
122
125
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.0.beta.
|
|
4
|
+
version: 4.0.0.beta.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Marin
|
|
8
8
|
- Mihai Marin
|
|
9
9
|
- Paul Bob
|
|
10
|
+
autorequire:
|
|
10
11
|
bindir: bin
|
|
11
12
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
+
date: 2026-04-07 00:00:00.000000000 Z
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: activerecord
|
|
@@ -1158,7 +1159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1158
1159
|
- !ruby/object:Gem::Version
|
|
1159
1160
|
version: '0'
|
|
1160
1161
|
requirements: []
|
|
1161
|
-
rubygems_version: 3.
|
|
1162
|
+
rubygems_version: 3.5.22
|
|
1163
|
+
signing_key:
|
|
1162
1164
|
specification_version: 4
|
|
1163
1165
|
summary: Admin panel framework and Content Management System for Ruby on Rails.
|
|
1164
1166
|
test_files: []
|