From 54499d6f64a47da285d8a32f625e63bfe64c6ab2 Mon Sep 17 00:00:00 2001 From: Julien Gautier Date: Tue, 26 May 2026 14:42:58 +0200 Subject: [PATCH] fix(seed): route prisma db seed through pnpm run for cwd resolution prisma db seed failed with "Cannot find module './seed.ts'" because the spawned ts-node command inherited the user's cwd (apps/portal-bff/) and resolved apps/portal-bff/prisma/seed.ts to apps/portal-bff/apps/portal-bff/prisma/seed.ts (doubled). pnpm run resets cwd to the package's root (workspace root) before running the script. Routing prisma.seed through pnpm run db:seed makes the path resolution cwd-invariant - works the same whether the user invokes from the workspace root or from apps/portal-bff/. Two-line diff: new db:seed script + prisma.seed delegates to it. Side benefit: pnpm db:seed is directly callable. --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6d5e3a9..8abd5ae 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "grpc:sync": "node scripts/sync-ai-protos.mjs", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", - "docs:preview": "vitepress preview docs" + "docs:preview": "vitepress preview docs", + "db:seed": "ts-node --transpile-only --compiler-options {\"module\":\"CommonJS\",\"esModuleInterop\":true,\"target\":\"ES2020\"} apps/portal-bff/prisma/seed.ts" }, "private": true, "lint-staged": { @@ -58,7 +59,7 @@ }, "prisma": { "schema": "apps/portal-bff/prisma/schema.prisma", - "seed": "ts-node --transpile-only --compiler-options {\"module\":\"CommonJS\",\"esModuleInterop\":true,\"target\":\"ES2020\"} apps/portal-bff/prisma/seed.ts" + "seed": "pnpm run db:seed" }, "devDependencies": { "@analogjs/vite-plugin-angular": "~2.5.0", -- 2.30.2