(
argv: string[],
config: PrismaConfigInternal,
baseDir: string = process.cwd(),
)
| 20 | |
| 21 | // parse arguments |
| 22 | public async parse( |
| 23 | argv: string[], |
| 24 | config: PrismaConfigInternal, |
| 25 | baseDir: string = process.cwd(), |
| 26 | ): Promise<string | Error> { |
| 27 | const args = arg(argv, { |
| 28 | '--schema': String, |
| 29 | }) |
| 30 | |
| 31 | if (isError(args)) { |
| 32 | throw new HelpError(`Invalid arguments supplied`) |
| 33 | } |
| 34 | |
| 35 | const info = await checkpoint.getInfo() |
| 36 | // SHA256 identifier for the project based on the Prisma schema path |
| 37 | const projectPathHash = getProjectHash( |
| 38 | createSchemaPathInput({ |
| 39 | schemaPathFromArgs: args['--schema'], |
| 40 | schemaPathFromConfig: config.schema, |
| 41 | baseDir, |
| 42 | }), |
| 43 | ) |
| 44 | // SHA256 of the cli path |
| 45 | const cliPathHash = getCLIPathHash() |
| 46 | |
| 47 | const cacheItems = info.cacheItems.map((it) => { |
| 48 | return { |
| 49 | product: it.output.product, |
| 50 | version: it.version, |
| 51 | package: it.output.package, |
| 52 | release_tag: it.output.release_tag, |
| 53 | cli_path: it.cli_path, |
| 54 | cli_path_hash: it.output.cli_path_hash, |
| 55 | last_reminder: it.last_reminder, |
| 56 | cached_at: it.cached_at, |
| 57 | } |
| 58 | }) |
| 59 | |
| 60 | return JSON.stringify( |
| 61 | { |
| 62 | signature: info.signature, |
| 63 | cachePath: info.cachePath, |
| 64 | current: { |
| 65 | projectPathHash, |
| 66 | cliPathHash, |
| 67 | }, |
| 68 | cacheItems, |
| 69 | }, |
| 70 | undefined, |
| 71 | 2, |
| 72 | ) |
| 73 | } |
| 74 | } |
nothing calls this directly
no test coverage detected