panda-core 0.8.4 β†’ 0.9.0

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: 28b16d6a5d79cf880c87149553332200a4b0c685fd1c9e654ec969475c85b1a7
4
- data.tar.gz: 67a0a3ae10b209c96219e3974f8917007443cfbd1734db1943c255c99554d674
3
+ metadata.gz: '09a8389d14bf25a5ebc6d546d1b3857b3515166393f9f5c9ba424337932b7ea5'
4
+ data.tar.gz: 406ab4fe14528cf664fcffaa8a371348bb71b91a68797db02002eee69d20d8f9
5
5
  SHA512:
6
- metadata.gz: 501c2f8db9b9a09c55d1c2c990672683a11e1fe63ff99067b2844edab3c7c31a10ef50c7f76658e0ce9862acfd0cdc5d979227f6b56ab18c797634b2a0343776
7
- data.tar.gz: ce9f83f3d6619f6bf6b58d29c4b589a6bb3727120e0695391edbe8c22007c50aeb96c1a508b1c9798386db6a9c567f31644943a48dc7978700fb0a7377e0d7fb
6
+ metadata.gz: 663c29fcfcb8e35cb7c4c8029ab242eae56421964bb9e9acc74b6d1c1f04d5e8ae9d4bb426349f5fec6c1df5f258047c490ba85ef5f8fc4fe429689b8538dc02
7
+ data.tar.gz: 22012fde38aaea3b480b31b1063515c079cc90c71e5e4a8a80428aafac457fac1a629c8b102076939bf4124ef026ae626e296d6b23b4d170b73974a62ee956bc
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Panda
4
4
  module Core
5
- VERSION = "0.8.4"
5
+ VERSION = "0.9.0"
6
6
  end
7
7
  end
@@ -1,98 +1,177 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ #
4
+ # Panda Core Asset Tasks
5
+ #
6
+ # This file contains BOTH:
7
+ # 1. Engine-level CSS compilation (existing functionality)
8
+ # 2. Dummy-app asset preparation for system tests (new)
9
+ #
10
+ # These tasks are used by:
11
+ # - engine developers running local dev
12
+ # - panda-cms CI preparing dummy app
13
+ # - system specs that depend on Propshaft + Importmap + Cuprite
14
+ #
15
+
3
16
  namespace :panda do
4
17
  namespace :core do
5
18
  namespace :assets do
19
+ # --------------------------------------------------------------------------
20
+ # 🐼 1. EXISTING TASKS β€” ENGINE CSS COMPILATION
21
+ # --------------------------------------------------------------------------
22
+
6
23
  desc "Compile Panda Core assets for development (overwrites panda-core.css)"
7
24
  task :compile do
8
- puts "🐼 Compiling Panda Core assets..."
25
+ puts "🐼 Compiling Panda Core CSS assets (development mode)..."
9
26
 
10
- # Create output directory
11
- output_dir = Panda::Core::Engine.root.join("public", "panda-core-assets")
27
+ output_dir = panda_engine_root.join("public", "panda-core-assets")
12
28
  FileUtils.mkdir_p(output_dir)
13
29
 
14
- # Compile CSS using Tailwind CSS v4
15
30
  compile_css_development(output_dir)
16
31
 
17
32
  puts "πŸŽ‰ Asset compilation complete!"
18
33
  puts "πŸ“ Output directory: #{output_dir}"
19
34
  puts ""
20
- puts "πŸ’‘ CSS is served via Rack middleware from Core gem at /panda-core-assets/panda-core.css"
21
- puts " No need to copy to CMS or other apps - they load it from Core automatically!"
22
35
  end
23
36
 
24
- desc "Compile and version Panda Core assets for release"
37
+ desc "Compile and version Panda Core CSS assets for release"
25
38
  task :release do
26
- puts "🐼 Compiling Panda Core assets for release..."
39
+ puts "🐼 Compiling Panda Core CSS assets for release..."
27
40
 
28
- # Get version
29
- require_relative "../panda/core/version"
41
+ require_relative "../../panda/core/version"
30
42
  version = Panda::Core::VERSION
31
- puts "Version: #{version}"
32
43
 
33
- # Create output directory
34
- output_dir = Panda::Core::Engine.root.join("public", "panda-core-assets")
44
+ output_dir = panda_engine_root.join("public", "panda-core-assets")
35
45
  FileUtils.mkdir_p(output_dir)
36
46
 
37
- # Compile CSS with versioning
38
47
  compile_css_release(output_dir, version)
39
48
 
40
49
  puts "πŸŽ‰ Release asset compilation complete!"
41
50
  puts "πŸ“ Output directory: #{output_dir}"
42
51
  puts "πŸ“¦ Versioned: panda-core-#{version}.css"
43
- puts "πŸ”— Symlink: panda-core.css -> panda-core-#{version}.css"
44
52
  end
45
53
 
46
- def compile_css_development(output_dir)
47
- puts "Compiling Tailwind CSS (development mode)..."
54
+ # --------------------------------------------------------------------------
55
+ # 🧩 INTERNAL HELPERS (CSS)
56
+ # --------------------------------------------------------------------------
57
+
58
+ def panda_engine_root
59
+ Panda::Core::Engine.root
60
+ end
48
61
 
49
- engine_root = Panda::Core::Engine.root
62
+ def compile_css_development(output_dir)
63
+ engine_root = panda_engine_root
50
64
  input_file = engine_root.join("app/assets/tailwind/application.css")
51
65
  output_file = output_dir.join("panda-core.css")
52
66
 
53
- # Get content paths from ModuleRegistry
54
67
  content_paths = Panda::Core::ModuleRegistry.tailwind_content_paths
55
- content_flags = content_paths.map { |path| "--content '#{path}'" }.join(" ")
68
+ content_flags = content_paths.map { |p| "--content '#{p}'" }.join(" ")
56
69
 
57
- # Compile with all registered module content
58
70
  cmd = "bundle exec tailwindcss -i #{input_file} -o #{output_file} #{content_flags} --minify"
59
71
 
60
- if system(cmd)
61
- puts "βœ… CSS compiled: #{output_file} (#{File.size(output_file)} bytes)"
62
- puts "πŸ“¦ Included content from: #{Panda::Core::ModuleRegistry.registered_modules.join(", ")}" if Panda::Core::ModuleRegistry.registered_modules.any?
63
- else
64
- puts "❌ CSS compilation failed"
65
- exit 1
72
+ unless system(cmd)
73
+ abort("❌ CSS compilation failed")
66
74
  end
75
+
76
+ puts "βœ… CSS compiled: #{output_file} (#{File.size(output_file)} bytes)"
67
77
  end
68
78
 
69
79
  def compile_css_release(output_dir, version)
70
- puts "Compiling Tailwind CSS (release mode)..."
71
-
72
- engine_root = Panda::Core::Engine.root
80
+ engine_root = panda_engine_root
73
81
  input_file = engine_root.join("app/assets/tailwind/application.css")
74
82
  versioned_file = output_dir.join("panda-core-#{version}.css")
75
83
 
76
- # Get content paths from ModuleRegistry
77
84
  content_paths = Panda::Core::ModuleRegistry.tailwind_content_paths
78
- content_flags = content_paths.map { |path| "--content '#{path}'" }.join(" ")
85
+ content_flags = content_paths.map { |p| "--content '#{p}'" }.join(" ")
79
86
 
80
- # Compile to versioned file with all registered module content
81
87
  cmd = "bundle exec tailwindcss -i #{input_file} -o #{versioned_file} #{content_flags} --minify"
82
88
 
83
- if system(cmd)
84
- puts "βœ… CSS compiled: #{versioned_file} (#{File.size(versioned_file)} bytes)"
85
- puts "πŸ“¦ Included content from: #{Panda::Core::ModuleRegistry.registered_modules.join(", ")}" if Panda::Core::ModuleRegistry.registered_modules.any?
86
-
87
- # Create/update unversioned symlink
88
- symlink = output_dir.join("panda-core.css")
89
- FileUtils.rm_f(symlink) if File.exist?(symlink)
90
- FileUtils.ln_sf(File.basename(versioned_file), symlink)
91
- puts "βœ… Created symlink: #{symlink} -> #{File.basename(versioned_file)}"
92
- else
93
- puts "❌ CSS compilation failed"
94
- exit 1
89
+ unless system(cmd)
90
+ abort("❌ CSS compilation failed")
91
+ end
92
+
93
+ symlink = output_dir.join("panda-core.css")
94
+ FileUtils.rm_f(symlink)
95
+ FileUtils.ln_sf(File.basename(versioned_file), symlink)
96
+
97
+ puts "βœ… Release CSS compiled + symlink generated"
98
+ end
99
+
100
+ # --------------------------------------------------------------------------
101
+ # πŸš‚ 2. NEW TASKS β€” DUMMY APP ASSET PREPARATION (FOR CI + SYSTEM TESTS)
102
+ # --------------------------------------------------------------------------
103
+
104
+ desc "Compile Panda Core + host app assets into spec/dummy/public/assets (CI)"
105
+ task compile_dummy: :environment do
106
+ dummy_root = find_dummy_root
107
+ assets_root = dummy_root.join("public/assets")
108
+
109
+ puts "🚧 Compiling assets into dummy app:"
110
+ puts "πŸ‘‰ #{assets_root}"
111
+
112
+ FileUtils.mkdir_p(assets_root)
113
+
114
+ Dir.chdir(dummy_root) do
115
+ # Runs the engine's asset compile pipeline in the dummy app context
116
+ unless system("bundle exec rake app:panda:core:assets:compile")
117
+ abort("❌ Failed to compile Panda Core assets in dummy app")
118
+ end
95
119
  end
120
+
121
+ puts "βœ… Dummy assets compiled"
122
+ end
123
+
124
+ desc "Generate importmap.json for Rails 8 dummy app"
125
+ task generate_dummy_importmap: :environment do
126
+ dummy_root = find_dummy_root
127
+ importmap_out = dummy_root.join("public/assets/importmap.json")
128
+
129
+ puts "πŸ—ΊοΈ Generating importmap.json..."
130
+ FileUtils.mkdir_p(importmap_out.dirname)
131
+
132
+ Dir.chdir(dummy_root) do
133
+ map = Rails.application.importmap
134
+ File.write(importmap_out, JSON.pretty_generate(map.to_json))
135
+ end
136
+
137
+ puts "βœ… importmap.json written to #{importmap_out}"
138
+ end
139
+
140
+ desc "Verify dummy app asset readiness (fail-fast for CI)"
141
+ task verify_dummy: :environment do
142
+ dummy_root = find_dummy_root
143
+ assets_root = dummy_root.join("public/assets")
144
+ manifest = assets_root.join(".manifest.json")
145
+ importmap = assets_root.join("importmap.json")
146
+
147
+ abort("❌ Missing directory: #{assets_root}") unless Dir.exist?(assets_root)
148
+ abort("❌ Missing #{manifest}") unless File.exist?(manifest)
149
+ abort("❌ Missing #{importmap}") unless File.exist?(importmap)
150
+
151
+ begin
152
+ parsed = JSON.parse(File.read(manifest))
153
+ abort("❌ Empty manifest!") if parsed.empty?
154
+ rescue
155
+ abort("❌ Invalid .manifest.json")
156
+ end
157
+
158
+ puts "βœ… Dummy assets verified"
159
+ end
160
+
161
+ # --------------------------------------------------------------------------
162
+ # 🧩 INTERNAL HELPERS (DUMMY APP)
163
+ # --------------------------------------------------------------------------
164
+
165
+ def find_dummy_root
166
+ root = Rails.root
167
+ return root if root.basename.to_s == "dummy"
168
+
169
+ # For engines, Rails.root will be e.g. panda-cms/
170
+ # In CI we want panda-cms/spec/dummy/
171
+ possible = root.join("spec/dummy")
172
+ return possible if possible.exist?
173
+
174
+ abort("❌ Cannot find dummy root at #{possible}")
96
175
  end
97
176
  end
98
177
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Otaina Limited