| 68 | * Loads the schema, throws an error if it is not found |
| 69 | */ |
| 70 | export async function getSchemaWithPath({ |
| 71 | schemaPath, |
| 72 | cwd = process.cwd(), |
| 73 | argumentName = '--schema', |
| 74 | }: GetSchemaOptions): Promise<GetSchemaResult> { |
| 75 | const result = await getSchemaWithPathInternal({ schemaPath, cwd, argumentName }) |
| 76 | if (result.ok) { |
| 77 | return result.schema |
| 78 | } |
| 79 | throw new Error(renderDefaultLookupError(result.error, cwd)) |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * The schema path can be provided as a CLI argument, a configuration file, or a base directory |