fix: correct static file mount order and update architecture validator
- Fix FastAPI static mount order: module statics must come BEFORE main
/static mount, otherwise the more general mount catches all requests
- Update validate_architecture.py to check self-contained module paths:
- JS files in app/modules/*/static/{admin,vendor}/js/
- Templates in app/modules/*/templates/*/{admin,vendor}/
- TPL-010 now finds module JS files for Alpine variable checking
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2906,10 +2906,13 @@ class ArchitectureValidator:
|
||||
print("🟨 Validating JavaScript...")
|
||||
|
||||
# Include admin, vendor, and shared JS files
|
||||
# Also include self-contained module JS files
|
||||
js_files = (
|
||||
list(target_path.glob("static/admin/js/**/*.js"))
|
||||
+ list(target_path.glob("static/vendor/js/**/*.js"))
|
||||
+ list(target_path.glob("static/shared/js/**/*.js"))
|
||||
+ list(target_path.glob("app/modules/*/static/admin/js/**/*.js"))
|
||||
+ list(target_path.glob("app/modules/*/static/vendor/js/**/*.js"))
|
||||
)
|
||||
self.result.files_checked += len(js_files)
|
||||
|
||||
@@ -3237,10 +3240,13 @@ class ArchitectureValidator:
|
||||
print("📄 Validating templates...")
|
||||
|
||||
# Include admin, vendor, and shop templates
|
||||
# Also include self-contained module templates
|
||||
template_files = (
|
||||
list(target_path.glob("app/templates/admin/**/*.html")) +
|
||||
list(target_path.glob("app/templates/vendor/**/*.html")) +
|
||||
list(target_path.glob("app/templates/shop/**/*.html"))
|
||||
list(target_path.glob("app/templates/shop/**/*.html")) +
|
||||
list(target_path.glob("app/modules/*/templates/*/admin/**/*.html")) +
|
||||
list(target_path.glob("app/modules/*/templates/*/vendor/**/*.html"))
|
||||
)
|
||||
self.result.files_checked += len(template_files)
|
||||
|
||||
@@ -3330,7 +3336,19 @@ class ArchitectureValidator:
|
||||
js_dir = None
|
||||
|
||||
if js_dir:
|
||||
# Check standard static path first
|
||||
js_file = target_path / f"static/{js_dir}/js/{template_name}.js"
|
||||
|
||||
# For module templates, check module static path
|
||||
# e.g., app/modules/cms/templates/cms/admin/content-pages.html
|
||||
# -> app/modules/cms/static/admin/js/content-pages.js
|
||||
if not js_file.exists() and "/modules/" in file_path_str:
|
||||
# Extract module name from path
|
||||
parts = file_path_str.split("/modules/")
|
||||
if len(parts) > 1:
|
||||
module_part = parts[1].split("/")[0] # e.g., "cms"
|
||||
js_file = target_path / f"app/modules/{module_part}/static/{js_dir}/js/{template_name}.js"
|
||||
|
||||
if js_file.exists():
|
||||
js_content = js_file.read_text()
|
||||
self._check_alpine_template_vars(file_path, content, lines, js_content)
|
||||
|
||||
Reference in New Issue
Block a user