From bd1a3483409e57cc6a2ab4391811eaef32a1b48e Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Tue, 5 May 2026 08:53:03 +0200 Subject: [PATCH] feat(web-next): add server bindAllProduction() aggregator with idempotent guard --- apps/web-next/src/server/bind-production.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 apps/web-next/src/server/bind-production.ts diff --git a/apps/web-next/src/server/bind-production.ts b/apps/web-next/src/server/bind-production.ts new file mode 100644 index 0000000..de306ce --- /dev/null +++ b/apps/web-next/src/server/bind-production.ts @@ -0,0 +1,18 @@ +// SERVER-ONLY: this module imports Payload config and must never be bundled into the browser. +import config from "@repo/core-cms"; +import { bindProductionBlog } from "@repo/blog/di/bind-production"; +import { bindProductionAuth } from "@repo/auth/di/bind-production"; +import { bindProductionMarketingPages } from "@repo/marketing-pages/di/bind-production"; +import { bindProductionNavigation } from "@repo/navigation/di/bind-production"; + +let bound = false; + +export async function bindAllProduction(): Promise { + if (bound) return; + bound = true; + const resolvedConfig = await config; + bindProductionAuth(resolvedConfig); + bindProductionBlog(resolvedConfig); + bindProductionMarketingPages(resolvedConfig); + bindProductionNavigation(resolvedConfig); +}