fix(seed): route prisma db seed through pnpm run for cwd resolution
CI / check (pull_request) Successful in 1m53s
CI / commits (pull_request) Successful in 4m12s
CI / scan (pull_request) Successful in 5m9s
CI / a11y (pull_request) Successful in 3m37s
Docs site / build (pull_request) Successful in 3m49s
CI / perf (pull_request) Successful in 9m9s
CI / check (pull_request) Successful in 1m53s
CI / commits (pull_request) Successful in 4m12s
CI / scan (pull_request) Successful in 5m9s
CI / a11y (pull_request) Successful in 3m37s
Docs site / build (pull_request) Successful in 3m49s
CI / perf (pull_request) Successful in 9m9s
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.
This commit is contained in:
+3
-2
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user