Spaces:
Sleeping
Sleeping
| /** | |
| * Simple verification script for theme consistency | |
| * Validates: Requirements 1.4, 5.3, 14.3 | |
| */ | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| console.log('='.repeat(70)); | |
| console.log('Theme Consistency Verification'); | |
| console.log('Feature: admin-ui-modernization, Property 1'); | |
| console.log('='.repeat(70)); | |
| console.log(''); | |
| // Read CSS file | |
| const cssPath = path.join(__dirname, '..', 'static', 'css', 'design-tokens.css'); | |
| const cssContent = fs.readFileSync(cssPath, 'utf-8'); | |
| // Required properties | |
| const requiredProps = [ | |
| 'color-primary', 'color-accent', 'color-success', 'color-warning', 'color-error', | |
| 'bg-primary', 'bg-secondary', 'text-primary', 'text-secondary', | |
| 'glass-bg', 'glass-border', 'border-color', | |
| 'gradient-primary', 'gradient-glass', | |
| 'font-family-primary', 'font-size-base', 'font-weight-normal', | |
| 'line-height-normal', 'letter-spacing-normal', | |
| 'spacing-xs', 'spacing-sm', 'spacing-md', 'spacing-lg', 'spacing-xl', | |
| 'shadow-sm', 'shadow-md', 'shadow-lg', | |
| 'blur-sm', 'blur-md', 'blur-lg', | |
| 'transition-fast', 'transition-base', 'ease-in-out' | |
| ]; | |
| // Check dark theme (:root) | |
| console.log('Checking Dark Theme (:root)...'); | |
| let darkMissing = []; | |
| for (const prop of requiredProps) { | |
| const regex = new RegExp(`--${prop}:\\s*[^;]+;`); | |
| if (!regex.test(cssContent)) { | |
| darkMissing.push(prop); | |
| } | |
| } | |
| if (darkMissing.length === 0) { | |
| console.log('β All required properties defined in dark theme'); | |
| } else { | |
| console.log(`β Missing ${darkMissing.length} properties in dark theme:`); | |
| darkMissing.forEach(p => console.log(` - ${p}`)); | |
| } | |
| console.log(''); | |
| // Check light theme | |
| console.log('Checking Light Theme ([data-theme="light"])...'); | |
| const lightRequiredProps = [ | |
| 'bg-primary', 'bg-secondary', 'text-primary', 'text-secondary', | |
| 'glass-bg', 'glass-border', 'border-color' | |
| ]; | |
| let lightMissing = []; | |
| const lightThemeMatch = cssContent.match(/\[data-theme="light"\]\s*{([^}]*)}/s); | |
| if (lightThemeMatch) { | |
| const lightBlock = lightThemeMatch[1]; | |
| for (const prop of lightRequiredProps) { | |
| const regex = new RegExp(`--${prop}:\\s*[^;]+;`); | |
| if (!regex.test(lightBlock)) { | |
| lightMissing.push(prop); | |
| } | |
| } | |
| } | |
| if (lightMissing.length === 0) { | |
| console.log('β All required overrides defined in light theme'); | |
| } else { | |
| console.log(`β Missing ${lightMissing.length} overrides in light theme:`); | |
| lightMissing.forEach(p => console.log(` - ${p}`)); | |
| } | |
| console.log(''); | |
| // Summary | |
| console.log('='.repeat(70)); | |
| if (darkMissing.length === 0 && lightMissing.length === 0) { | |
| console.log('β VERIFICATION PASSED'); | |
| console.log('All required CSS custom properties are properly defined.'); | |
| process.exit(0); | |
| } else { | |
| console.log('β VERIFICATION FAILED'); | |
| console.log('Some required properties are missing.'); | |
| process.exit(1); | |
| } | |