MCPcopy
hub / github.com/prisma/prisma / getCliProvidedSchemaFile

Function getCliProvidedSchemaFile

packages/internals/src/cli/getSchema.ts:235–252  ·  view source on GitHub ↗
(
  schemaPathFromArgs: string,
  cwd: string = process.cwd(),
  argumentName: string = '--schema',
)

Source from the content-addressed store, hash-verified

233}
234
235export async function getCliProvidedSchemaFile(
236 schemaPathFromArgs: string,
237 cwd: string = process.cwd(),
238 argumentName: string = '--schema',
239): Promise<GetSchemaResult> {
240 const absPath = path.resolve(cwd, schemaPathFromArgs)
241 const customSchemaResult = await readSchemaFromFileOrDirectory(absPath)
242 if (!customSchemaResult.ok) {
243 const relPath = path.relative(cwd, absPath)
244 throw new Error(
245 `Could not load \`${argumentName}\` from provided path \`${relPath}\`: ${renderLookupError(
246 customSchemaResult.error,
247 )}`,
248 )
249 }
250
251 return customSchemaResult.schema
252}
253
254export async function getConfigProvidedSchemaFile(schemaPathFromConfig: string): Promise<GetSchemaResult> {
255 const schemaResult = await readSchemaFromFileOrDirectory(schemaPathFromConfig)

Callers 4

validate.test.tsFile · 0.90
testAgainstPreformattedFunction · 0.90

Calls 2

renderLookupErrorFunction · 0.85

Tested by 1

testAgainstPreformattedFunction · 0.72