Seeds: guardSeedExit() — a run that ends early exits 1 with the reason, never a silent 0
payload run starts the CLI with `void start()` and imports the script; when the script's top-level await is left without live handles, Node exits with code 0 and no output — a success in Coolify's Terminal. guardSeedExit() (@intecion/ipal-kit/seed, dependency-free) listens for beforeExit: until summary() runs it prints "[seed] ended before Payload initialized" / "… before the seed finished" and exits 1. createSeeder marks the run initialized, summary() finished; process.exit paths (normal, errors, the production refusals) are untouched. Wired into the ipal-site and ipal-form seed templates and the reference seed, so ipal-kit create sites get it. Tests include a real child process started like payload run. Docs: seeding.md, deployment.md §4.7, AGENT.md, ipal-reference (+ api.md), CHANGELOG Unreleased. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
55dc69b69f
commit
f789e36636
+7
-1
@@ -6,8 +6,9 @@
|
||||
* // scripts/seed-content.ts — pnpm payload run scripts/seed-content.ts
|
||||
* import config from '@payload-config'
|
||||
* import { getPayload } from 'payload'
|
||||
* import { createSeeder } from '@intecion/ipal-kit/seed'
|
||||
* import { createSeeder, guardSeedExit } from '@intecion/ipal-kit/seed'
|
||||
*
|
||||
* guardSeedExit() // first: an early exit (no Payload, unfinished run) becomes exit 1, not a silent 0
|
||||
* const seed = createSeeder(await getPayload({ config }))
|
||||
* await seed.upsertBySlug('pages', [{ title: { pl: 'Kontakt', en: 'Contact' }, slug: { pl: 'kontakt', en: 'contact' } }])
|
||||
* await seed.fillGlobal('header', { links: [] })
|
||||
@@ -18,8 +19,10 @@
|
||||
* package throws in plain Node, and `payload run` is plain Node.
|
||||
*/
|
||||
export {
|
||||
activeSeedExitGuard,
|
||||
createSeeder,
|
||||
editedSinceSeed,
|
||||
guardSeedExit,
|
||||
isLocalDatabase,
|
||||
projectOnto,
|
||||
seedHash,
|
||||
@@ -29,6 +32,9 @@ export type {
|
||||
EditedSinceSeedArgs,
|
||||
Seeder,
|
||||
SeederOptions,
|
||||
SeedExitGuard,
|
||||
SeedExitGuardOptions,
|
||||
SeedExitProcess,
|
||||
SeedResult,
|
||||
SeedStatus,
|
||||
SeedSummary,
|
||||
|
||||
Reference in New Issue
Block a user