MCPcopy
hub / github.com/prisma/prisma / transformPathsInConfigToAbsolute

Function transformPathsInConfigToAbsolute

packages/config/src/loadConfigFromFile.ts:259–287  ·  view source on GitHub ↗
(
  prismaConfig: PrismaConfigInternal,
  resolvedPath: string,
)

Source from the content-addressed store, hash-verified

257}
258
259function transformPathsInConfigToAbsolute(
260 prismaConfig: PrismaConfigInternal,
261 resolvedPath: string,
262): PrismaConfigInternal {
263 function resolvePath(value: string | undefined) {
264 if (!value) {
265 return undefined
266 }
267
268 return path.resolve(path.dirname(resolvedPath), value)
269 }
270
271 return {
272 ...prismaConfig,
273 schema: resolvePath(prismaConfig.schema),
274 migrations: {
275 ...prismaConfig.migrations,
276 path: resolvePath(prismaConfig.migrations?.path),
277 },
278 typedSql: {
279 ...prismaConfig.typedSql,
280 path: resolvePath(prismaConfig.typedSql?.path),
281 },
282 views: {
283 ...prismaConfig.views,
284 path: resolvePath(prismaConfig.views?.path),
285 },
286 }
287}

Callers 1

loadConfigFromFileFunction · 0.85

Calls 1

resolvePathFunction · 0.85

Tested by

no test coverage detected