Database naming rule; seeding after launch touches named records only
- Rule (VERY IMPORTANT): databases are named <domain without dots>_prod /
_dev (intecion.com → intecioncom_prod / intecioncom_dev) on MongoDB and
Postgres — AGENT.md top rules, deployment.md §4.2a (Coolify), env.md,
ipal-setup architecture questions (derive, then confirm), AGENTS.md
template. ipalEnvRules({ databaseName }) warns (never fails) on a
mismatch, domain from NEXT_PUBLIC_SERVER_URL or { domain }, { warn }
overridable; helpers databaseNamesFor, databaseNameFromUri,
checkDatabaseName from the root and /env.
- Rule (VERY IMPORTANT): after launch never re-seed everything — AGENT.md,
seeding.md, ipal-site, ipal-form, ipal-reference. createSeeder gains
`only` / SEED_ONLY (pages:slug, forms:title, global:slug, collection:*;
the rest → "skip (not listed)") and refuses a run with no record list
against a production / non-local database unless IPAL_SEED_ALLOW_FULL=1
(guard.allowFull; dry runs allowed). Seed templates carry an ONLY list;
the form seed touches only its own form.
- Tests: seed only/full-run guard, database-name helpers and warning.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9ecab39783
commit
af7d96f0e3
+18
-2
@@ -36,6 +36,19 @@ patch `node_modules` or fork the package.
|
||||
**Docs language:** all ipal-kit docs, this guide and the skills are written in English.
|
||||
Write new rules, AGENTS.md entries and plugin-gap reports in English.
|
||||
|
||||
> **VERY IMPORTANT — seeding after launch.** Once a site is live, **never run a full seed again**: the owner's
|
||||
> edits on the live site must survive. Every later change targets **named records only** — specific pages,
|
||||
> globals, forms or fields — listed in the seed (`only: [...]` / `SEED_ONLY="pages:kontakt,global:header"`).
|
||||
> Never re-seed everything, not even in create-only mode, without the owner's explicit OK. `createSeeder`
|
||||
> refuses a run with no record list against a production or non-local database unless `IPAL_SEED_ALLOW_FULL=1`
|
||||
> (set it only after that OK).
|
||||
|
||||
**Database names** (MongoDB and Postgres): the site's domain **with the dots removed**, plus `_prod` or `_dev` —
|
||||
`intecion.com` → `intecioncom_prod` / `intecioncom_dev`, `architektimprez.pl` → `architektimprezpl_prod` /
|
||||
`architektimprezpl_dev`. The name is the path of `DATABASE_URI`: `mongodb://…@mongo:27017/intecioncom_prod?authSource=admin`,
|
||||
`postgres://…@db:5432/intecioncom_prod`. You derive the names from the domain and confirm them with the owner (ipal-setup
|
||||
stage 0). `ipalEnvRules({ databaseName: true })` warns when they do not match (deployment.md §4.2a).
|
||||
|
||||
**Seeding on production** (details: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Write seeds with
|
||||
`createSeeder` from `@intecion/ipal-kit/seed` (the templates do) — it enforces every rule below:
|
||||
- Seeds are create-only and idempotent: match by the default-locale slug / form title / the global, skip what exists.
|
||||
@@ -44,6 +57,7 @@ Write new rules, AGENTS.md entries and plugin-gap reports in English.
|
||||
- On production: dry run first (`SEED_DRY_RUN=1`), back up the database (Coolify **Backup now**), then the real run.
|
||||
- `SEED_UPDATE=1` on production / a non-local database only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`, after a backup;
|
||||
records an editor changed are always skipped and reported (`skip (edited)`) — never use `SEED_FORCE=1` there.
|
||||
- After launch: named records only (`only` / `SEED_ONLY`); a full run of a live database is refused without `IPAL_SEED_ALLOW_FULL=1`.
|
||||
- Schema and one-off data fixes → Payload migrations; field renames with content → **ipal-migrate-fields**; content → seeds.
|
||||
|
||||
## Ask before you build — architecture questions
|
||||
@@ -60,7 +74,7 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
|
||||
| Forms | which forms, who receives them, e-mail provider (SMTP from the panel or Microsoft Graph) |
|
||||
| Analytics and consent | GA4 / GTM / pixels, Consent Mode basic or advanced, cookie banner mode, cookie scan |
|
||||
| SEO / GEO | market and local business data, AI crawler policy (llms.txt, Markdown, MCP, AI bots) |
|
||||
| Data and media | database (Postgres or MongoDB), media storage (R2 or local disk) |
|
||||
| Data and media | database (Postgres or MongoDB) and its names (`<domain without dots>_prod` / `_dev` — derive, then confirm), media storage (R2 or local disk) |
|
||||
| Admin | 2FA, white-label (client brand in the panel), agency credit |
|
||||
| Hosting | Coolify, the production domain(s), who adds the DNS records (deployment.md §6) |
|
||||
|
||||
@@ -1290,10 +1304,12 @@ Write everything in this file in English.
|
||||
|
||||
## Project decisions
|
||||
- Architecture answers (AGENT.md "Ask before you build"), one line each: languages + default + URLs ·
|
||||
styling · pages/collections · forms + e-mail · analytics/consent/cookie scan · SEO/GEO · database + media ·
|
||||
styling · pages/collections · forms + e-mail · analytics/consent/cookie scan · SEO/GEO · database (+ names
|
||||
`<domain>_prod` / `<domain>_dev`, e.g. `intecioncom_prod`) + media ·
|
||||
2FA/white-label/credit · hosting + domains + DNS
|
||||
- <client-specific decisions, e.g. "blog without authors", "404 = homepage">
|
||||
- <approved workarounds: what, why, plugin-request file, owner's approval>
|
||||
- Launch date: <date> — from then on seeds touch named records only (AGENT.md "seeding after launch")
|
||||
- <exceptions to the rules — with the reason>
|
||||
- <only on a client decision> ipal-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
|
||||
```
|
||||
|
||||
@@ -114,6 +114,8 @@ Commit the script — in production run it after the migration: `SEED_DRY_RUN=1`
|
||||
the real run (rules: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Changing the form: fix FORM,
|
||||
`SEED_UPDATE=1 pnpm payload run …` — it updates the form only if nobody edited it since seeding (otherwise
|
||||
`skip (edited)`); on production / a non-local database it also needs `IPAL_SEED_ALLOW_PROD_UPDATE=1`.
|
||||
**After launch** a form seed touches only its own form (`only: ['forms:<title>']` in the template) — never re-run
|
||||
every form seed or the content seed to change one form (AGENT.md "seeding after launch").
|
||||
|
||||
Details the seed already covers, which you check after every manual change in the panel:
|
||||
1. **Forms → the form**: fields from the brief, `name` in English, lowercase
|
||||
|
||||
@@ -106,7 +106,9 @@ function richText(text: string) {
|
||||
|
||||
const payload = await getPayload({ config })
|
||||
// Options (docs/seeding.md § Turn off, override, extend) — env vars work without editing this file.
|
||||
const seed = createSeeder(payload, { label: '[seed-form]' })
|
||||
// A form seed touches exactly one record — this form (matched by its title). After launch that stays true:
|
||||
// it never re-seeds other forms, and an edited form is skipped (docs/seeding.md, "after launch").
|
||||
const seed = createSeeder(payload, { label: '[seed-form]', only: [`forms:${FORM.title}`] })
|
||||
|
||||
// Notification address — from the panel, never from this file.
|
||||
let notifyTo = process.env.SEED_NOTIFY_EMAIL?.trim() ?? ''
|
||||
|
||||
@@ -149,7 +149,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| languages | `src/i18n.config.ts` | `export const i18nConfig = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }] } as const satisfies I18nConfig` | `curl -sI $U/` → 3xx to `/pl` | i18n.md |
|
||||
| proxy | `src/proxy.ts` | `export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })` + `export const config = { matcher: ['/((?!api\|admin\|_next\|.*\\..*).*)'] }` (a literal!) | `curl -sI $U/` → `/pl`; `curl -s -H 'Accept: text/markdown' $U/pl` → Markdown | i18n.md, PROGRAMISTA §2.6 |
|
||||
| proxy (Next 15 / custom) | `middleware`/`proxy.ts` | `createLocaleMiddleware({ config, … })` (`/next/middleware` or the main entry) | as above | i18n.md |
|
||||
| env validation | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))` from `@intecion/ipal-kit/env` | remove a variable → startup fails with the list of missing ones | env.md |
|
||||
| env validation | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true, ipHeader: true, databaseName: true }))` from `@intecion/ipal-kit/env` | remove a variable → startup fails with the list of missing ones; a database not named `<domain>_prod`/`_dev` → a warning | env.md, deployment.md §4.2a |
|
||||
| Next config | `next.config.ts` | `withPayload(withSecurityConfig({ images: buildImagesConfig(), htmlLimitedBots: /Googlebot\|Bingbot…/i, headers: async () => [{ source: '/:path*', headers: buildSecurityHeaders({ hsts, csp }) }, { source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, ...buildUploadSecurityHeaders()] }))` | `curl -sI $U/pl \| grep -iE 'x-content-type\|strict-transport\|x-powered-by'` (no `x-powered-by`) | security.md, storage.md, PROGRAMISTA §2.9 |
|
||||
| CSP | `next.config.ts`, `src/app/api/csp-report/route.ts` | `csp = { mode: 'report-only', reportUri: '/api/csp-report', r2Url, <flags> }` in `buildSecurityHeaders` + `buildAdminCspHeaders`; route `export const POST = createCspReportRoute()`; after clean reports `mode: 'enforce'` | `curl -sI $U/pl \| grep -i content-security-policy-report-only`; browser console and `[csp]` log lines without violations | security.md |
|
||||
| data / routes | `src/lib/content.ts` | `export const { … } = createContentHelpers({ config, content, i18n: i18nConfig, baseUrl, markdownAlternate: true, summaryField: 'aiSummary', mcp: { serverName } })` | `pnpm tsc --noEmit` | frontend.md, PROGRAMISTA §2.7 |
|
||||
@@ -218,7 +218,7 @@ and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `ba
|
||||
|
||||
| variable | required when | effect when missing | where to set |
|
||||
|---|---|---|---|
|
||||
| `DATABASE_URI` | always (Payload; `ipalEnvRules` always) | no database, startup fails | env (name: `databaseVar`) |
|
||||
| `DATABASE_URI` | always (Payload; `ipalEnvRules` always) | no database, startup fails | env (name: `databaseVar`); the database is named `<domain without dots>_prod` / `_dev` (`intecioncom_prod`), checked by `databaseName: true` |
|
||||
| `PAYLOAD_SECRET` | always | Payload does not start; `assertEnv` throws | env, ≥32 characters, different in prod (`secretVar`) |
|
||||
| `NEXT_PUBLIC_SERVER_URL` | always (`kind: 'url'`) | sitemap/robots/canonical/JSON-LD/llms with origin `''` (relative), IndexNow does not send, R2 relative URL without a prefix | env (`serverUrlVar`) |
|
||||
| `NODE_ENV` | no (`development`/`production`/`test`) | `production` is stricter: R2 and `IPAL_IP_HEADER` required, IndexNow works, IP warning, `buildImagesConfig` prod | set by Next / hosting |
|
||||
@@ -237,13 +237,15 @@ Details: env.md, deployment.md, PROGRAMISTA §3.
|
||||
|
||||
**DNS** (A/AAAA, www, CAA, Search Console TXT, Bing, SPF/DKIM/DMARC for the From domain, R2 domain): the plugin sets nothing — list of records to check with `dig`: `deployment.md` §6, summary in **ipal-setup** stage 11.
|
||||
|
||||
**Seeding** (content in pages, forms, globals): create-only, matched by a natural key, never delete, never seed users or secrets, dry run → backup → real run; updates on production only for untouched records and only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Helper: `createSeeder` from `@intecion/ipal-kit/seed` (resources/api.md → Seeding). Templates: `ipal-site/resources/seed-content.template.ts`, `ipal-form/resources/seed-form.template.ts`. Rules and Coolify steps: `node_modules/@intecion/ipal-kit/docs/seeding.md`.
|
||||
**Seeding** (content in pages, forms, globals) — **VERY IMPORTANT: after launch never re-seed everything; named records only** (`only` / `SEED_ONLY`; a full run of a live database needs the owner's OK and `IPAL_SEED_ALLOW_FULL=1`). Create-only, matched by a natural key, never delete, never seed users or secrets, dry run → backup → real run; updates on production only for untouched records and only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Helper: `createSeeder` from `@intecion/ipal-kit/seed` (resources/api.md → Seeding). Templates: `ipal-site/resources/seed-content.template.ts`, `ipal-form/resources/seed-form.template.ts`. Rules and Coolify steps: `node_modules/@intecion/ipal-kit/docs/seeding.md`.
|
||||
|
||||
| Seed env var (run time) | Effect |
|
||||
|---|---|
|
||||
| `SEED_DRY_RUN=1` (or `--dry-run`) | no writes, print the plan |
|
||||
| `SEED_UPDATE=1` | also update records nobody edited since seeding |
|
||||
| `IPAL_SEED_ALLOW_PROD_UPDATE=1` | allow `SEED_UPDATE=1` on production / a non-local database (back up first) |
|
||||
| `SEED_ONLY` | the records a run may touch (`pages:kontakt,global:header`) — required after launch |
|
||||
| `IPAL_SEED_ALLOW_FULL=1` | allow a run without `SEED_ONLY` on production / a non-local database — owner's explicit OK only |
|
||||
| `SEED_FORCE=1` | with `SEED_UPDATE=1`: overwrite edited records too — local database only |
|
||||
| `SEED_LOCAL_HOSTS` | extra hosts that count as a local database (comma-separated) |
|
||||
| `SEED_DB_URL_ENV` | name of the env var holding the database URL (default `DATABASE_URI`) |
|
||||
|
||||
@@ -254,7 +254,10 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `assertEnv(rules, { env?, label? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | validates `process.env` against the rules at startup; collects every missing item and throws one error |
|
||||
| `ipalEnvRules({ storage?, emailGraph?, ipHeader?, turnstile?, serverUrlVar?, secretVar?, databaseVar? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | ready rule set (`DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL` + `R2_*`/`GRAPH_*`/Turnstile/`IPAL_IP_HEADER` depending on the features used) for `assertEnv`; `R2_PUBLIC_URL` optional unless `storage: { requirePublicUrl: true }` |
|
||||
| `ipalEnvRules({ storage?, emailGraph?, ipHeader?, turnstile?, serverUrlVar?, secretVar?, databaseVar?, databaseName? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | ready rule set (`DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL` + `R2_*`/`GRAPH_*`/Turnstile/`IPAL_IP_HEADER` depending on the features used) for `assertEnv`; `R2_PUBLIC_URL` optional unless `storage: { requirePublicUrl: true }`; `databaseName: true \| { domain?, warn? }` only warns when the `DATABASE_URI` database is not `<domain without dots>_prod` / `_dev` |
|
||||
| `databaseNamesFor(domainOrUrl)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the two database names for a site: `intecion.com` → `{ prod: 'intecioncom_prod', dev: 'intecioncom_dev' }` (`www.` dropped, dots removed) |
|
||||
| `databaseNameFromUri(uri)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the database name (URI path) of a Mongo / Postgres `DATABASE_URI`; null for SQLite files or no name |
|
||||
| `checkDatabaseName({ databaseUri, domain })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | warning text when the name breaks the rule, else null (skips localhost / no domain) — what `databaseName` uses |
|
||||
|
||||
**Types:** `EnvRule`, `EnvKind` — variable rule (`name`, `required`, `kind`, `oneOf`, `validate`); `AssertEnvOptions` — `assertEnv` options; `IpalEnvFeatures` — `ipalEnvRules` argument (all from `/env` and root).
|
||||
|
||||
@@ -520,7 +523,7 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `createSeeder(payload, { dryRun?, update?, force?, guard?, editCheck?, context?, pagesCollection?, label?, log? })` | `@intecion/ipal-kit/seed` | The seed rules in one place → `{ upsertBySlug, upsertBy, fillGlobal, summary, dryRun, update, force, local }`. Create-only by default, natural keys, never deletes, globals: empty fields only, every locale with `fallbackLocale: false` onto the same row ids, skips records edited since seeding, writes with `context` `{ ipalSeed, disableRevalidate, ipalSkipIndexNow }`. Throws when `update` runs on production / a non-local database without `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Both seed templates use it. |
|
||||
| `createSeeder(payload, { dryRun?, update?, force?, only?, guard?, editCheck?, context?, pagesCollection?, label?, log? })` | `@intecion/ipal-kit/seed` | The seed rules in one place → `{ upsertBySlug, upsertBy, fillGlobal, summary, dryRun, update, force, local, only }`. `only` (or `SEED_ONLY`) = the records the run may touch (`pages:kontakt`, `forms:<title>`, `global:<slug>`, `pages:*`), the rest → `skip (not listed)`; a run without it against production / a non-local database throws unless `IPAL_SEED_ALLOW_FULL=1` (after launch: named records only). Create-only by default, natural keys, never deletes, globals: empty fields only, every locale with `fallbackLocale: false` onto the same row ids, skips records edited since seeding, writes with `context` `{ ipalSeed, disableRevalidate, ipalSkipIndexNow }`. Throws when `update` runs on production / a non-local database without `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Both seed templates use it. |
|
||||
| `upsertBySlug(collection, data \| data[], { slugField? })` | (method of `createSeeder`) | Matches by the default-locale slug; an array creates missing records first, so `{ $page: 'slug' }` links work in any order. |
|
||||
| `upsertBy(collection, key, data)` | (method) | Matches by other keys, e.g. a form by `{ title }`. |
|
||||
| `fillGlobal(slug, data)` | (method) | Fills only empty fields of a global (all seeded fields with `update` when untouched). |
|
||||
|
||||
@@ -43,13 +43,19 @@ Before I set up the site I need your decisions on:
|
||||
5. Analytics and consent: GA4 / GTM / Meta / other pixels? Consent Mode basic or advanced? Cookie dialog
|
||||
inline / modal / detailed? Cookie scan of the finished site?
|
||||
6. SEO/GEO: market, local business (address, opening hours)? AI access (llms.txt, Markdown, MCP, AI bots) — on?
|
||||
7. Database: Postgres or MongoDB? Media: Cloudflare R2 or local disk (Coolify volume)?
|
||||
7. Database: Postgres or MongoDB? Names (rule: domain without dots + _prod / _dev) — for <domain> I will use
|
||||
<domainnodots>_prod and <domainnodots>_dev, OK? Media: Cloudflare R2 or local disk (Coolify volume)?
|
||||
8. Admin: 2FA (on by default), white-label with the client's logo, agency credit in the panel?
|
||||
9. Hosting: Coolify — which server/project? Production domain(s), www or apex? Who adds the DNS records?
|
||||
```
|
||||
**Code.** None — write every answer into `AGENTS.md` → "Project decisions" (one line per topic; template: AGENT.md §13).
|
||||
|
||||
**Check.** All nine topics have an answer in "Project decisions"; nothing in it says "assumed" or "default".
|
||||
**Database names** (VERY IMPORTANT, deployment.md §4.2a): derive them from the production domain — dots removed,
|
||||
plus `_prod` / `_dev` (`intecion.com` → `intecioncom_prod`, `intecioncom_dev`; `architektimprez.pl` →
|
||||
`architektimprezpl_prod`, `architektimprezpl_dev`) — and confirm them in question 7. Never `payload`, `test` or a guess.
|
||||
|
||||
**Check.** All nine topics have an answer in "Project decisions" (including both database names); nothing in it
|
||||
says "assumed" or "default".
|
||||
|
||||
**Turn off / override.** Never skipped. If the owner says "you decide" for a topic, write that down as their answer,
|
||||
propose a concrete choice and get a yes before you build it.
|
||||
@@ -403,7 +409,7 @@ export function register() {
|
||||
if (process.env.NEXT_RUNTIME !== 'nodejs') return
|
||||
// R2_PUBLIC_URL optional: media served through the app by default (storage.md, env.md)
|
||||
assertEnv(
|
||||
ipalEnvRules({ storage: true, ipHeader: true /* , emailGraph: true with Graph */ }).map((r) =>
|
||||
ipalEnvRules({ storage: true, ipHeader: true, databaseName: true /* , emailGraph: true with Graph */ }).map((r) =>
|
||||
r.name === 'R2_PUBLIC_URL' ? { ...r, required: false } : r,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -80,6 +80,9 @@ form with fields in JSX, an `api/contact` route, `nodemailer`, reCAPTCHA (AGENT.
|
||||
enter content from the brief: pages, blocks, links (`{ $page: 'slug' }`), globals —
|
||||
all languages side by side (`{ pl, en }`). Missing data → `[TO FILL: …]`.
|
||||
Never invent company data, prices, reviews, numbers, certificates, names.
|
||||
**VERY IMPORTANT — after launch never run the whole seed again** (the owner's edits must survive): a later
|
||||
change lists exactly the records it touches in `ONLY` / `SEED_ONLY` (e.g. `pages:kontakt,global:header`),
|
||||
checked with a dry run; a full re-seed only with the owner's explicit OK (`IPAL_SEED_ALLOW_FULL=1`).
|
||||
The template is a thin script over `createSeeder` (`@intecion/ipal-kit/seed`): keep the calls
|
||||
(`upsertBySlug`, `fillGlobal`, `summary`), change only CONTENT; options in docs/seeding.md.
|
||||
2. `pnpm payload run scripts/seed-content.ts` → the placeholder list goes into the report.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* SEED_DRY_RUN=1 pnpm payload run scripts/seed-content.ts # no writes: prints create / skip / update per record
|
||||
* pnpm payload run scripts/seed-content.ts # creates what's missing, never overwrites
|
||||
* SEED_UPDATE=1 pnpm payload run scripts/seed-content.ts # also updates records nobody edited since seeding
|
||||
* SEED_ONLY="pages:kontakt" pnpm payload run … # only the listed records (or set ONLY below)
|
||||
* (`--dry-run` after the script path works too, e.g. `pnpm seed:content --dry-run`.)
|
||||
*
|
||||
* The rules live in createSeeder (@intecion/ipal-kit/seed), so fixes arrive with a
|
||||
@@ -16,6 +17,10 @@
|
||||
* - Every locale is written with `fallbackLocale: false` onto the same row ids.
|
||||
* - Writes carry ipalSkipIndexNow, disableRevalidate and ipalSeed in `context`.
|
||||
* - Never seed users, passwords or secrets (SMTP, Turnstile, API keys) — panel / env.
|
||||
* - VERY IMPORTANT — after launch: never run the whole seed again. The owner's edits on the live
|
||||
* site must survive. List exactly the records this run may touch in ONLY (or SEED_ONLY); the rest
|
||||
* is reported as "skip (not listed)". A run without a list against a production / non-local
|
||||
* database is refused unless IPAL_SEED_ALLOW_FULL=1 — only with the owner's explicit OK.
|
||||
*
|
||||
* Write content ONCE, all languages side by side:
|
||||
* heading: { pl: 'Nasze usługi', en: 'Our services' } → localized value
|
||||
@@ -47,11 +52,14 @@ const GLOBALS: { slug: string; data: Record<string, unknown> }[] = [
|
||||
// { slug: 'header', data: { links: [{ link: { type: 'internal', page: { $page: 'kontakt' }, label: { pl: 'Kontakt', en: 'Contact' } } }] } },
|
||||
]
|
||||
const COLLECTION = 'pages'
|
||||
// Before launch: undefined (the whole site). After launch: ONLY the records the owner asked for, e.g.
|
||||
// ['pages:kontakt', 'global:header'] — `collection:<default-locale slug>`, `global:<slug>`, `collection:*`.
|
||||
const ONLY: string[] | undefined = undefined
|
||||
// ----------------------------------------------------------------- /CONTENT --
|
||||
|
||||
// Options (docs/seeding.md § Turn off, override, extend) — env vars work without editing this file:
|
||||
// createSeeder(payload, { editCheck: { hashField: false }, guard: { localHosts: ['db'] }, context: { … } })
|
||||
const seed = createSeeder(await getPayload({ config }), { pagesCollection: COLLECTION })
|
||||
const seed = createSeeder(await getPayload({ config }), { only: ONLY, pagesCollection: COLLECTION })
|
||||
|
||||
// One call for all pages: missing ones are created first, so $page links work in any order.
|
||||
await seed.upsertBySlug(COLLECTION, PAGES)
|
||||
|
||||
Reference in New Issue
Block a user