Files
Website-Nov26/scripts/verificar-prohibidas.mjs
T
Collina SystemsandClaude Fable 5.1 221b2d21a8 ci(despliegue): fase 5, Dockerfile, nginx, verificaciones y Lighthouse CI
- Dockerfile multi-etapa: build con Playwright (sitio, PDF, precompresión) y
  nginx sin privilegios en 8080 con healthcheck
- nginx: CSP sin unsafe-inline, HSTS, nosniff, Referrer-Policy, caché inmutable
  para assets con hash, gzip_static, página 404 y /salud
- scripts: verificar-prohibidas (falla con PLD, Odoo, lavado, CHM, 115/2026 en
  dist/), verificar-metricas (falla con resultado sin método), comprimir
- Lighthouse CI con umbral 95 en móvil y presupuesto de 1.5 MB / 50 KB de JS
- GitHub Actions: check, build, verificaciones, PDF, Lighthouse e imagen Docker

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-04 12:51:31 -06:00

35 lines
1.3 KiB
JavaScript

// Falla si en dist/ aparece alguna palabra prohibida (BRIEF §2). Revisa los
// archivos de texto publicados: HTML, CSS, JS, XML, TXT, JSON, SVG, incluidos
// comentarios y metadatos. Uso: node scripts/verificar-prohibidas.mjs [dist]
import { readdirSync, readFileSync, statSync } from 'node:fs';
import path from 'node:path';
const dist = path.resolve(process.argv[2] ?? 'dist');
const PROHIBIDAS = /\b(PLD|Odoo|lavado|CHM|115\/2026)\b/i;
const TEXTO = new Set(['.html', '.css', '.js', '.mjs', '.xml', '.txt', '.json', '.svg', '.webmanifest']);
function* archivos(dir) {
for (const nombre of readdirSync(dir)) {
const ruta = path.join(dir, nombre);
if (statSync(ruta).isDirectory()) yield* archivos(ruta);
else if (TEXTO.has(path.extname(nombre))) yield ruta;
}
}
const hallazgos = [];
let revisados = 0;
for (const ruta of archivos(dist)) {
revisados++;
const lineas = readFileSync(ruta, 'utf8').split('\n');
lineas.forEach((linea, i) => {
const m = PROHIBIDAS.exec(linea);
if (m) hallazgos.push(`${path.relative(dist, ruta)}:${i + 1}: "${m[1]}"`);
});
}
if (hallazgos.length) {
console.error(`Palabras prohibidas en ${hallazgos.length} línea(s):\n ${hallazgos.join('\n ')}`);
process.exit(1);
}
console.log(`Sin palabras prohibidas en ${revisados} archivos de ${path.relative(process.cwd(), dist) || '.'}`);