MCPcopy
hub / github.com/deepnote/deepnote / diffDeepnoteFiles

Function diffDeepnoteFiles

packages/cli/src/commands/diff.ts:82–110  ·  view source on GitHub ↗
(
  path1: string | undefined,
  path2: string | undefined,
  options: DiffOptions
)

Source from the content-addressed store, hash-verified

80}
81
82async 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.

Callers 1

createDiffActionFunction · 0.85

Calls 7

debugFunction · 0.90
decodeUtf8NoBomFunction · 0.90
deserializeDeepnoteFileFunction · 0.90
computeDiffFunction · 0.85
outputDiffJsonFunction · 0.85
printDiffFunction · 0.85

Tested by

no test coverage detected