feat(features): add bind-dev-seed binders for auth/marketing-pages/navigation/media

Mirrors the canonical blog pattern landed earlier on this branch.

Per feature:
- src/__seeds__/dev.ts — lazy buildDev<Entities>() function using the
  feature's existing factory for sensible defaults
- src/di/bind-dev-seed.ts — bindDevSeed<Feature>() async function that
  rebinds the repo symbol(s) to a populated MockXRepository via
  .toConstantValue
- src/di/bind-dev-seed.test.ts — 3+ tests per feature (populates,
  reachable by id/slug, idempotent)
- package.json — adds ./di/bind-dev-seed subpath export

Tests + use cases continue to construct mocks directly; the seed never
runs from a *.test.ts path. App boot wiring (USE_DEV_SEED env branch)
follows in a separate commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 19:04:33 +02:00
parent e6560bc9cb
commit 10479c4d55
16 changed files with 603 additions and 4 deletions

View File

@@ -0,0 +1,55 @@
import { pageFactory } from "../__factories__/page.factory.js";
import { siteSettingsFactory } from "../__factories__/site-settings.factory.js";
import type { Page } from "../entities/models/page.js";
import type { SiteSettings } from "../entities/models/site-settings.js";
/**
* Realistic marketing-pages seed for dev mode + storybook stories.
*
* Built from `pageFactory` / `siteSettingsFactory` so factory defaults take
* care of boring fields and we only override what makes the data look like a
* real site.
*
* Lazily produced so importing this module is side-effect-free — the
* factory's sequence counter only advances when a binder calls
* `buildDevPages()` / `buildDevSiteSettings()`.
*/
export function buildDevPages(): Page[] {
const SEED_DATE = new Date("2026-01-01T00:00:00.000Z");
return [
pageFactory.build({
id: "home",
slug: "home",
title: "Home",
hero: { heading: "Welcome to our site" },
status: "published",
publishedAt: SEED_DATE,
seo: { title: "Home | My App" },
}),
pageFactory.build({
id: "about",
slug: "about",
title: "About Us",
hero: { heading: "Our story" },
status: "published",
publishedAt: SEED_DATE,
seo: { title: "About | My App" },
}),
pageFactory.build({
id: "pricing",
slug: "pricing",
title: "Pricing",
hero: { heading: "Simple, transparent pricing" },
status: "published",
publishedAt: SEED_DATE,
seo: { title: "Pricing | My App" },
}),
];
}
export function buildDevSiteSettings(): SiteSettings {
return siteSettingsFactory.build({
siteName: "My App",
siteDescription: "A vertical-feature monorepo template",
});
}