MCPcopy
hub / github.com/deepnote/deepnote / convertDirectoryToDeepnote

Function convertDirectoryToDeepnote

packages/cli/src/commands/convert.ts:232–269  ·  view source on GitHub ↗
(
  dirPath: string,
  inputFormat: SourceNotebookFormat,
  options: ConvertOptions
)

Source from the content-addressed store, hash-verified

230}
231
232async function convertDirectoryToDeepnote(
233 dirPath: string,
234 inputFormat: SourceNotebookFormat,
235 options: ConvertOptions
236): Promise<ConvertResult> {
237 const outputDir = options.output ? resolve(process.cwd(), options.output) : dirPath
238 const projectName = options.name ?? basename(dirPath)
239 const projectId = randomUUID()
240
241 const quiet = getOutputConfig().quiet
242 const spinner = quiet ? null : ora(`Converting ${INPUT_FORMAT_NAMES[inputFormat]} to Deepnote files...`).start()
243
244 try {
245 const result = await convertDirectoryToDeepnoteCore({
246 inputDir: dirPath,
247 format: inputFormat,
248 outputDir,
249 projectName,
250 projectId,
251 })
252
253 spinner?.succeed(
254 `${result.outputFiles.length} Deepnote file${result.outputFiles.length === 1 ? '' : 's'} saved to ${getChalk().bold(outputDir)}`
255 )
256
257 return {
258 success: true,
259 inputPath: dirPath,
260 outputPath: outputDir,
261 inputFormat,
262 outputFormat: 'deepnote',
263 outputIsDirectory: true,
264 }
265 } catch (error) {
266 spinner?.fail('Conversion failed')
267 throw error
268 }
269}

Callers 1

handleConvertToFunction · 0.90

Calls 3

getOutputConfigFunction · 0.90
getChalkFunction · 0.90
startMethod · 0.80

Tested by

no test coverage detected