- Ported Minimalist templates to JSON (Swiss Grid, Brutalist, etc.) - Ported Tech templates to JSON (SaaS, Terminal, Cyberpunk, etc.) - Ported Creative templates to JSON (Art Gallery, Zine, Pop Art, etc.) - Ported Industrial templates to JSON (Blueprint, Factory, Schematic, etc.) - Ported Nature templates to JSON (Botanical, Ocean, Mountain, etc.) - Ported Lifestyle templates to JSON (Cookbook, Travel, Coffee House, etc.) - Ported Vintage templates to JSON (Art Deco, Medieval, Retro 80s, etc.) - Updated README.md to reflect the new JSON-based style system (example configuration and contribution workflow) - Completed migration of over 150 styles to the new architecture
95 lines
4.1 KiB
PowerShell
95 lines
4.1 KiB
PowerShell
# Template Audit Script
|
|
# Analyzes all templates against research-paper.json reference
|
|
|
|
$reference = Get-Content "src-tauri\templates\academic\research-paper.json" | ConvertFrom-Json
|
|
$templateFiles = Get-ChildItem -Path "src-tauri\templates" -Recurse -Filter "*.json"
|
|
|
|
$requiredElements = @('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'blockquote', 'code', 'pre',
|
|
'ul', 'ol', 'li', 'strong', 'em', 'a', 'table', 'th', 'td',
|
|
'hr', 'img', 'del', 'sup', 'sub', 'mark', 'footnote', 'footnoteRef')
|
|
|
|
$requiredColors = @('text', 'textSecondary', 'background', 'accent', 'border', 'codeBg', 'blockquoteBorder')
|
|
$requiredFonts = @('heading', 'body', 'code')
|
|
|
|
Write-Host "`n=== TEMPLATE AUDIT REPORT ===" -ForegroundColor Cyan
|
|
Write-Host "Reference: research-paper.json with $($requiredElements.Count) elements`n" -ForegroundColor Green
|
|
|
|
$issues = @()
|
|
|
|
foreach ($file in $templateFiles) {
|
|
try {
|
|
$template = Get-Content $file.FullName | ConvertFrom-Json
|
|
$templateName = "$($template.category)/$($template.id)"
|
|
|
|
# Check elements
|
|
$missingElements = @()
|
|
$elementKeys = if ($template.elements) { $template.elements.PSObject.Properties.Name | Where-Object { $_ -notlike "_comment*" } } else { @() }
|
|
|
|
foreach ($element in $requiredElements) {
|
|
if ($element -notin $elementKeys) {
|
|
$missingElements += $element
|
|
}
|
|
}
|
|
|
|
# Check colors
|
|
$missingColors = @()
|
|
$colorKeys = if ($template.typography.colors) { $template.typography.colors.PSObject.Properties.Name | Where-Object { $_ -notlike "_comment*" } } else { @() }
|
|
|
|
foreach ($color in $requiredColors) {
|
|
if ($color -notin $colorKeys) {
|
|
$missingColors += $color
|
|
}
|
|
}
|
|
|
|
# Check fonts
|
|
$missingFonts = @()
|
|
$fontKeys = if ($template.typography.fonts) { $template.typography.fonts.PSObject.Properties.Name | Where-Object { $_ -notlike "_comment*" } } else { @() }
|
|
|
|
foreach ($font in $requiredFonts) {
|
|
if ($font -notin $fontKeys) {
|
|
$missingFonts += $font
|
|
}
|
|
}
|
|
|
|
# Report issues
|
|
if ($missingElements.Count -gt 0 -or $missingColors.Count -gt 0 -or $missingFonts.Count -gt 0) {
|
|
$issue = [PSCustomObject]@{
|
|
Template = $templateName
|
|
MissingElements = $missingElements.Count
|
|
MissingColors = $missingColors.Count
|
|
MissingFonts = $missingFonts.Count
|
|
ElementsList = ($missingElements -join ', ')
|
|
ColorsList = ($missingColors -join ', ')
|
|
FontsList = ($missingFonts -join ', ')
|
|
}
|
|
$issues += $issue
|
|
|
|
Write-Host "❌ $templateName" -ForegroundColor Red
|
|
if ($missingElements.Count -gt 0) {
|
|
Write-Host " Missing $($missingElements.Count) elements: $($missingElements -join ', ')" -ForegroundColor Yellow
|
|
}
|
|
if ($missingColors.Count -gt 0) {
|
|
Write-Host " Missing $($missingColors.Count) colors: $($missingColors -join ', ')" -ForegroundColor Yellow
|
|
}
|
|
if ($missingFonts.Count -gt 0) {
|
|
Write-Host " Missing $($missingFonts.Count) fonts: $($missingFonts -join ', ')" -ForegroundColor Yellow
|
|
}
|
|
} else {
|
|
Write-Host "✅ $templateName" -ForegroundColor Green
|
|
}
|
|
|
|
} catch {
|
|
Write-Host "❌ Error parsing $($file.Name): $_" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
Write-Host "`n=== SUMMARY ===" -ForegroundColor Cyan
|
|
Write-Host "Total templates: $($templateFiles.Count)" -ForegroundColor White
|
|
Write-Host "Templates with issues: $($issues.Count)" -ForegroundColor Yellow
|
|
Write-Host "Templates complete: $($templateFiles.Count - $issues.Count)" -ForegroundColor Green
|
|
|
|
if ($issues.Count -gt 0) {
|
|
Write-Host "`nTemplates needing fixes:" -ForegroundColor Yellow
|
|
$issues | Format-Table Template, MissingElements, MissingColors, MissingFonts -AutoSize
|
|
}
|