From a37609d449e7b0745983a0499137b7d1b30bab51 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Thu, 17 Sep 2026 19:11:52 -0700 Subject: [PATCH] fix(scripts): resolve the postgres driver from apps/hub (CL-8407) --- scripts/db-setup.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/db-setup.ts b/scripts/db-setup.ts index 754219185b..d6059455d6 100644 --- a/scripts/db-setup.ts +++ b/scripts/db-setup.ts @@ -31,13 +31,12 @@ type PostgresFactory = (options: { onnotice: () => undefined; }) => SqlClient; -// Resolved dynamically rather than imported statically: this script's -// own tsconfig has no "bun" condition, which is what lets `postgres` -// and apps/hub's own source resolve under the hub's tsconfig. Loading -// both through Bun's own runtime resolver instead keeps this script -// out of that cross-project typecheck entirely. +// The driver is the hub's dependency, so it resolves from apps/hub rather +// than from this script's own directory. +const hubDir = new URL("../apps/hub/", import.meta.url).pathname; + async function loadPostgres(): Promise { - const resolved = Bun.resolveSync("postgres", import.meta.dir); + const resolved = Bun.resolveSync("postgres", hubDir); const loaded = (await import(resolved)) as { default: PostgresFactory }; return loaded.default; }