Primera versión del plugin
This commit is contained in:
148
verify-styles.js
Normal file
148
verify-styles.js
Normal file
@@ -0,0 +1,148 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('🔍 Verificador de Estilos FontAwesome Pro\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
// Configuración
|
||||
const WEBFONTS_DIR = path.join(__dirname, 'assets', 'fontawesome', 'webfonts');
|
||||
const METADATA_DIR = path.join(__dirname, 'assets', 'fontawesome', 'metadata');
|
||||
const CSS_DIR = path.join(__dirname, 'assets', 'fontawesome', 'css');
|
||||
|
||||
// Archivos requeridos para cada estilo
|
||||
const REQUIRED_FILES = {
|
||||
'solid': ['fa-solid-900.woff2', 'fa-solid-900.ttf'],
|
||||
'regular': ['fa-regular-400.woff2', 'fa-regular-400.ttf'],
|
||||
'light': ['fa-light-300.woff2', 'fa-light-300.ttf'],
|
||||
'thin': ['fa-thin-100.woff2', 'fa-thin-100.ttf'],
|
||||
'duotone': ['fa-duotone-900.woff2', 'fa-duotone-900.ttf'],
|
||||
'sharp-solid': ['fa-sharp-solid-900.woff2', 'fa-sharp-solid-900.ttf'],
|
||||
'sharp-regular': ['fa-sharp-regular-400.woff2', 'fa-sharp-regular-400.ttf'],
|
||||
'sharp-light': ['fa-sharp-light-300.woff2', 'fa-sharp-light-300.ttf'],
|
||||
'sharp-thin': ['fa-sharp-thin-100.woff2', 'fa-sharp-thin-100.ttf'],
|
||||
'sharp-duotone': ['fa-sharp-duotone-900.woff2', 'fa-sharp-duotone-900.ttf'],
|
||||
'brands': ['fa-brands-400.woff2', 'fa-brands-400.ttf']
|
||||
};
|
||||
|
||||
// Verificar directorios
|
||||
console.log('\n📁 Verificando directorios...');
|
||||
const directories = [
|
||||
{ name: 'webfonts', path: WEBFONTS_DIR },
|
||||
{ name: 'metadata', path: METADATA_DIR },
|
||||
{ name: 'css', path: CSS_DIR }
|
||||
];
|
||||
|
||||
directories.forEach(dir => {
|
||||
if (fs.existsSync(dir.path)) {
|
||||
console.log(` ✅ ${dir.name}: Existe`);
|
||||
const files = fs.readdirSync(dir.path);
|
||||
console.log(` Archivos: ${files.length}`);
|
||||
} else {
|
||||
console.log(` ❌ ${dir.name}: No existe`);
|
||||
}
|
||||
});
|
||||
|
||||
// Verificar archivos de fuentes
|
||||
console.log('\n🎨 Verificando archivos de fuentes...');
|
||||
let totalFound = 0;
|
||||
let totalRequired = 0;
|
||||
|
||||
Object.entries(REQUIRED_FILES).forEach(([style, files]) => {
|
||||
console.log(`\n ${style}:`);
|
||||
|
||||
let foundCount = 0;
|
||||
files.forEach(file => {
|
||||
const filePath = path.join(WEBFONTS_DIR, file);
|
||||
if (fs.existsSync(filePath)) {
|
||||
console.log(` ✅ ${file}`);
|
||||
foundCount++;
|
||||
totalFound++;
|
||||
} else {
|
||||
console.log(` ❌ ${file} (Faltante)`);
|
||||
}
|
||||
totalRequired++;
|
||||
});
|
||||
|
||||
if (foundCount === files.length) {
|
||||
console.log(` 🎉 ${style} completo`);
|
||||
} else if (foundCount > 0) {
|
||||
console.log(` ⚠️ ${style} parcial (${foundCount}/${files.length})`);
|
||||
} else {
|
||||
console.log(` ❌ ${style} no disponible`);
|
||||
}
|
||||
});
|
||||
|
||||
// Verificar metadata
|
||||
console.log('\n📊 Verificando metadata...');
|
||||
const metadataPath = path.join(METADATA_DIR, 'icons.json');
|
||||
if (fs.existsSync(metadataPath)) {
|
||||
try {
|
||||
const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf8'));
|
||||
const iconCount = Object.keys(metadata).length;
|
||||
console.log(` ✅ Metadata válido`);
|
||||
console.log(` Íconos: ${iconCount}`);
|
||||
|
||||
// Verificar si hay estilos sharp en metadata
|
||||
const sampleIcon = Object.values(metadata)[0];
|
||||
if (sampleIcon && sampleIcon.styles) {
|
||||
const hasSharp = sampleIcon.styles.some(s =>
|
||||
s.toLowerCase().includes('sharp')
|
||||
);
|
||||
console.log(` Estilos Sharp: ${hasSharp ? 'Sí' : 'No'}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(` ❌ Error en metadata: ${error.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log(' ❌ Metadata no encontrado');
|
||||
}
|
||||
|
||||
// Verificar archivos generados
|
||||
console.log('\n🛠️ Verificando archivos generados...');
|
||||
const generatedFiles = [
|
||||
{ name: 'Base de datos', path: path.join(__dirname, 'assets', 'icons.json') },
|
||||
{ name: 'CSS Dinámico', path: path.join(__dirname, 'assets', 'dynamic-styles.css') },
|
||||
{ name: 'CSS Personalizado', path: path.join(__dirname, 'assets', 'custom-styles.css') }
|
||||
];
|
||||
|
||||
generatedFiles.forEach(file => {
|
||||
if (fs.existsSync(file.path)) {
|
||||
const stats = fs.statSync(file.path);
|
||||
console.log(` ✅ ${file.name}: ${(stats.size / 1024).toFixed(2)} KB`);
|
||||
} else {
|
||||
console.log(` ❌ ${file.name}: No generado`);
|
||||
}
|
||||
});
|
||||
|
||||
// Resumen
|
||||
console.log('\n' + '='.repeat(60));
|
||||
console.log('📈 RESUMEN FINAL');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
const percentage = ((totalFound / totalRequired) * 100).toFixed(1);
|
||||
console.log(`\nArchivos de fuentes: ${totalFound}/${totalRequired} (${percentage}%)`);
|
||||
|
||||
if (percentage >= 90) {
|
||||
console.log('✅ Excelente! Tienes casi todos los estilos.');
|
||||
} else if (percentage >= 50) {
|
||||
console.log('⚠️ Tienes la mayoría de estilos básicos.');
|
||||
} else {
|
||||
console.log('❌ Faltan muchos estilos. Considera actualizar FontAwesome Pro.');
|
||||
}
|
||||
|
||||
console.log('\n🎯 RECOMENDACIONES:');
|
||||
if (totalFound < totalRequired) {
|
||||
console.log(' 1. Descarga la versión completa de FontAwesome 6 Pro');
|
||||
console.log(' 2. Copia todos los archivos de webfonts/');
|
||||
console.log(' 3. Ejecuta: npm run build');
|
||||
} else {
|
||||
console.log(' 1. ¡Todo está listo!');
|
||||
console.log(' 2. Ejecuta: npm run build (si no lo has hecho)');
|
||||
}
|
||||
|
||||
console.log('\n🚀 COMANDOS DISPONIBLES:');
|
||||
console.log(' • npm run build - Generar/actualizar base de datos');
|
||||
console.log(' • npm run update - Verificar y actualizar estilos');
|
||||
console.log(' • npm run verify - Verificar archivos (este comando)');
|
||||
|
||||
console.log('\n' + '='.repeat(60));
|
||||
Reference in New Issue
Block a user