import { getPayload } from 'payload' import configPromise from '../src/payload.config' async function run() { const payload = await getPayload({ config: configPromise }) const locales = ['pl', 'de'] let foundEmpty = false for (const locale of locales) { const pages = await payload.find({ collection: 'pages', locale: locale as 'pl'|'de', limit: 100 }) for (const page of pages.docs) { const layout = page.layout || [] for (const block of layout) { // Iterate over keys of the block to find arrays for (const key of Object.keys(block)) { const value = block[key] if (Array.isArray(value) && value.length === 0) { // Some arrays might naturally be empty if they are optional, but most of these are required // Let's flag any empty array in these block fields if (['steps', 'questions', 'services', 'members', 'stats', 'points', 'testimonials', 'logos', 'bullets', 'checkmarks'].includes(key)) { console.log(`[UWAGA] Pusta tablica '${key}' znaleziona w bloku '${block.blockType}' na stronie '${page.slug}' (locale: ${locale})`) foundEmpty = true } } } } } } if (!foundEmpty) { console.log("Wszystkie tablice w blokach na stronach (PL i DE) są pełne. Stan: OK.") } process.exit(0) } run().catch(console.error)