import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; import { resolve, dirname } from 'path'; import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); // Список всех страниц const routes = [ '/', '/products', '/about', // добавьте свои URL ]; const distPath = resolve(__dirname, '../dist'); const indexHtmlPath = resolve(distPath, 'index.html'); if (!existsSync(indexHtmlPath)) { console.error('❌ Сначала запустите npm run build'); process.exit(1); } // Читаем исходный HTML let baseHtml = readFileSync(indexHtmlPath, 'utf-8'); // Добавляем базовые мета-теги для каждой страницы const pages = { '/': { title: 'Магазин труб - Главная', description: 'Купить канализационные трубы по низким ценам' }, '/products': { title: 'Каталог труб для канализации', description: 'Широкий выбор труб, фитингов и комплектующих' }, '/about': { title: 'О магазине труб', description: 'Информация о нашей компании' } }; routes.forEach(route => { const pageInfo = pages[route] || pages['/']; // Заменяем мета-теги в HTML let html = baseHtml .replace(/