MCPcopy Create free account
hub / github.com/6174/comflowyspace / cloneComfyUI

Function cloneComfyUI

apps/node/src/modules/comfyui/bootstrap.ts:410–453  ·  view source on GitHub ↗
(dispatch: TaskEventDispatcher)

Source from the content-addressed store, hash-verified

408}
409
410export async function cloneComfyUI(dispatch: TaskEventDispatcher): Promise<boolean> {
411 let success = false;
412 let lastError = null;
413 const { PIP_PATH, PYTHON_PATH } = conda.getCondaPaths();
414
415 for (let i = 0; i < 3; i++) {
416 try {
417 const repoPath = getComfyUIDir();
418 const parentDir = path.dirname(repoPath);
419 await fsExtra.ensureDir(parentDir);
420
421 if (!await checkIfInstalledComfyUI()) {
422 dispatch({
423 message: 'Start cloning ComfyUI...'
424 });
425 await runCommand(`git clone https://github.com/comfyanonymous/ComfyUI.git`, dispatch, {
426 cwd: parentDir
427 });
428 }
429
430 await runCommand(`${PIP_PATH} install -r requirements.txt`, dispatch, {
431 cwd: repoPath
432 });
433
434 const sdPath = getStableDiffusionDir()
435 if (sdPath !== "") {
436 createOrUpdateExtraConfigFileFromStableDiffusion(sdPath)
437 }
438
439 dispatch({
440 message: "clone comfyui success"
441 });
442
443 success = true;
444 break;
445 } catch (error: any) {
446 lastError = error;
447 }
448 }
449 if (!success) {
450 throw new Error(`clone comfyui error: ${lastError.message}`);
451 }
452 return true;
453}

Callers 1

ApiBootstrapFunction · 0.90

Calls 6

getComfyUIDirFunction · 0.90
runCommandFunction · 0.90
getStableDiffusionDirFunction · 0.90
checkIfInstalledComfyUIFunction · 0.85
getCondaPathsMethod · 0.80

Tested by

no test coverage detected