mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
- Add Post + Tag collections (notícias/publicações) with tag-based "Esconder" visibility control for electoral-law compliance - Add static SEO routes /[type]/[category]/[slug] plus /[type] and /[type]/[category] listings, with shared header/breadcrumb and PostCard - Recreate the homepage and refresh the site color palette (styles.css) - Add posts/slug/seo utilities and revalidation wiring (documents.ts) - Add live-fetch seed script (scripts/seed-posts.mjs + seed-loader.mjs, db:seed:posts) - Upgrade Payload 3.79.0 -> 3.82.0 (fixes admin relationship-filter crash) - Remove obsolete Header component; add shadcn card/badge/breadcrumb; update AGENTS.md and components rule docs
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
/**
|
|
* Seed-only Node module loader: stubs `next/cache` with no-ops.
|
|
*
|
|
* The `post` and `tag` collections call `revalidateTag()` (via
|
|
* `src/utilities/documents.ts`) inside their `afterChange` hooks. `revalidateTag`
|
|
* throws "static generation store missing" when called outside a Next.js request
|
|
* scope — which is exactly what happens in a standalone seed script, aborting
|
|
* every `payload.create`. Rather than editing the collections (owned elsewhere),
|
|
* we replace `next/cache` with harmless no-ops for the duration of the seed.
|
|
*
|
|
* Registered via `--import=./scripts/seed-loader.mjs` in the `db:seed:posts`
|
|
* npm script; it affects only that process.
|
|
*/
|
|
import { register } from 'node:module'
|
|
|
|
const shim =
|
|
'data:text/javascript,' +
|
|
encodeURIComponent(
|
|
[
|
|
'export const revalidateTag = () => {};',
|
|
'export const revalidatePath = () => {};',
|
|
'export const unstable_cache = (fn) => fn;',
|
|
'export const unstable_noStore = () => {};',
|
|
].join('\n'),
|
|
)
|
|
|
|
const hooks =
|
|
'data:text/javascript,' +
|
|
encodeURIComponent(
|
|
`export function resolve(specifier, context, nextResolve) {
|
|
if (specifier === 'next/cache') {
|
|
return { url: ${JSON.stringify(shim)}, shortCircuit: true }
|
|
}
|
|
return nextResolve(specifier, context)
|
|
}`,
|
|
)
|
|
|
|
register(hooks)
|