fix(seed): use tsconfig.app.json instead of inline --compiler-options
CI / check (pull_request) Successful in 1m46s
CI / scan (pull_request) Successful in 4m55s
CI / commits (pull_request) Successful in 6m28s
CI / a11y (pull_request) Successful in 7m36s
Docs site / build (pull_request) Successful in 6m36s
CI / perf (pull_request) Successful in 13m46s

The inline --compiler-options '{"module":"CommonJS",...}' was being
unquoted by the shell when pnpm run db:seed re-spawned ts-node:

  > ts-node --compiler-options {module:CommonJS,esModuleInterop:true,...}

  SyntaxError: Expected property name or '}' in JSON at position 1

Cross-platform quoting of JSON-on-cmdline is a notorious pain.
apps/portal-bff/tsconfig.app.json already declares all the options
we need (module=commonjs, esModuleInterop=true, target=es2021,
moduleResolution=node, types=[node]). Point ts-node at it with -P
and drop the inline JSON entirely.

ts-node --transpile-only ignores the tsconfig's `include`/`exclude`
fields for the file passed explicitly, so the fact that seed.ts is
under prisma/ (not src/) doesn't matter.
This commit is contained in:
Julien Gautier
2026-05-26 14:50:04 +02:00
parent 827d69594c
commit 9e92fdd820
+1 -1
View File
@@ -17,7 +17,7 @@
"docs:dev": "vitepress dev docs", "docs:dev": "vitepress dev docs",
"docs:build": "vitepress build 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" "db:seed": "ts-node --transpile-only -P apps/portal-bff/tsconfig.app.json apps/portal-bff/prisma/seed.ts"
}, },
"private": true, "private": true,
"lint-staged": { "lint-staged": {