Files
Fernando Davila OyarzabalandClaude Opus 5.5 80934bb826
CI / Tipos, build, contenido y Lighthouse (push) Has been cancelled
CI / Imagen Docker (push) Has been cancelled
fix(despliegue): dominio canónico collinasystems.com
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 15:01:44 -06:00

48 lines
3.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Genera public/img/og.png (1200×630) con las fuentes del sitio usando Playwright.
// Uso: node scripts/og.mjs
import { chromium } from 'playwright';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
import os from 'node:os';
const raiz = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const fuentes = path.join(raiz, 'public', 'fonts');
const html = `<!doctype html><html lang="es"><head><meta charset="utf-8"><style>
@font-face{font-family:'Fraunces';src:url('file://${fuentes}/fraunces-latin-opsz-normal.woff2') format('woff2-variations');font-weight:100 900}
@font-face{font-family:'Instrument Sans';src:url('file://${fuentes}/instrument-sans-latin-wght-normal.woff2') format('woff2-variations');font-weight:400 700}
@font-face{font-family:'JetBrains Mono';src:url('file://${fuentes}/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');font-weight:100 800}
html,body{margin:0;width:1200px;height:630px;background:#07172a;color:#fff;overflow:hidden}
.c{padding:72px 80px;position:relative;height:630px;box-sizing:border-box}
h1{font-family:'Fraunces';font-weight:700;font-size:92px;line-height:1;margin:0;letter-spacing:-.015em;font-variation-settings:'opsz' 144}
h1 small{font-family:'Instrument Sans';font-weight:600;font-size:22px;letter-spacing:.2em;text-transform:uppercase;color:#8a94a3;margin-left:14px;vertical-align:middle}
p{font-family:'Instrument Sans';font-size:34px;line-height:1.4;color:#b4bdca;max-width:900px;margin:36px 0 0}
.d{position:absolute;left:80px;bottom:72px;font-family:'JetBrains Mono';font-size:24px;color:#7f9cff}
svg{position:absolute;right:80px;bottom:60px}
</style></head><body><div class="c">
<h1>Collina<small>Systems</small></h1>
<p>Sistemas para la operación: ventas, inventario, cobranza, flotillas, contratos, estaciones de servicio, personal.</p>
<div class="d">collinasystems.com</div>
<svg width="300" height="120" viewBox="0 0 300 120" fill="none" stroke="#7f9cff" stroke-opacity=".7" stroke-width="2"><rect x="1" y="40" width="80" height="40" rx="5"/><rect x="110" y="20" width="80" height="80" rx="5"/><rect x="219" y="40" width="80" height="40" rx="5"/><path d="M81 60h29M190 60h29"/></svg>
</div></body></html>`;
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1200, height: 630 }, deviceScaleFactor: 1 });
// Se abre como archivo para que las fuentes file:// carguen (desde about:blank no se permite).
const tmp = mkdtempSync(path.join(os.tmpdir(), 'og-'));
const archivo = path.join(tmp, 'og.html');
writeFileSync(archivo, html);
await page.goto('file://' + archivo, { waitUntil: 'load' });
await page.evaluate(() =>
Promise.all([
document.fonts.load("700 92px 'Fraunces'"),
document.fonts.load("600 22px 'Instrument Sans'"),
document.fonts.load("400 34px 'Instrument Sans'"),
document.fonts.load("400 24px 'JetBrains Mono'"),
]).then(() => document.fonts.ready),
);
await page.screenshot({ path: path.join(raiz, 'public', 'img', 'og.png'), type: 'png' });
await browser.close();
rmSync(tmp, { recursive: true, force: true });
console.log('public/img/og.png generado');