( path1: string | undefined, path2: string | undefined, options: DiffOptions )
| 80 | } |
| 81 | |
| 82 | async function diffDeepnoteFiles( |
| 83 | path1: string | undefined, |
| 84 | path2: string | undefined, |
| 85 | options: DiffOptions |
| 86 | ): Promise<void> { |
| 87 | const { absolutePath: absolutePath1 } = await resolvePathToDeepnoteFile(path1) |
| 88 | const { absolutePath: absolutePath2 } = await resolvePathToDeepnoteFile(path2) |
| 89 | |
| 90 | debug('Reading file 1...') |
| 91 | const rawBytes1 = await fs.readFile(absolutePath1) |
| 92 | const yamlContent1 = decodeUtf8NoBom(rawBytes1) |
| 93 | const file1 = deserializeDeepnoteFile(yamlContent1) |
| 94 | |
| 95 | debug('Reading file 2...') |
| 96 | const rawBytes2 = await fs.readFile(absolutePath2) |
| 97 | const yamlContent2 = decodeUtf8NoBom(rawBytes2) |
| 98 | const file2 = deserializeDeepnoteFile(yamlContent2) |
| 99 | |
| 100 | const diffResult = computeDiff(absolutePath1, absolutePath2, file1, file2, options) |
| 101 | |
| 102 | switch (options.output) { |
| 103 | case 'json': |
| 104 | outputDiffJson(diffResult) |
| 105 | break |
| 106 | case undefined: |
| 107 | printDiff(diffResult, options) |
| 108 | break |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Compute the structural diff between two .deepnote files. |
no test coverage detected