forked from boos/BoosAPI
chore: vendor workflow ui as submodule
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[submodule "vendor/ComfyUI_frontend"]
|
||||
path = vendor/ComfyUI_frontend
|
||||
url = https://github.com/Comfy-Org/ComfyUI_frontend.git
|
||||
branch = main
|
||||
@@ -3,9 +3,10 @@ import path from 'path';
|
||||
import { spawn } from 'child_process';
|
||||
|
||||
const ROOT = process.cwd();
|
||||
const REPO = process.env.BOOSAPI_WORKFLOW_UI_REPO || 'https://github.com/Comfy-Org/ComfyUI_frontend.git';
|
||||
const REPO = process.env.BOOSAPI_WORKFLOW_UI_REPO || '';
|
||||
const REF = process.env.BOOSAPI_WORKFLOW_UI_REF || 'v1.46.1';
|
||||
const DIR = path.join(ROOT, '.cache', 'comfyui-frontend');
|
||||
const SUBMODULE_DIR = path.join(ROOT, 'vendor', 'ComfyUI_frontend');
|
||||
const CACHE_DIR = path.join(ROOT, '.cache', 'comfyui-frontend');
|
||||
const DIST = path.join(ROOT, 'dist', 'workflow-ui');
|
||||
|
||||
function run(command, args, options = {}) {
|
||||
@@ -24,9 +25,15 @@ function run(command, args, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
await fs.mkdir(path.dirname(DIR), { recursive: true });
|
||||
await fs.rm(DIR, { recursive: true, force: true });
|
||||
await run('git', ['clone', '--depth', '1', '--branch', REF, REPO, DIR]);
|
||||
const hasSubmodule = await fs.access(path.join(SUBMODULE_DIR, 'package.json')).then(() => true, () => false);
|
||||
const DIR = REPO ? CACHE_DIR : SUBMODULE_DIR;
|
||||
if (REPO) {
|
||||
await fs.mkdir(path.dirname(CACHE_DIR), { recursive: true });
|
||||
await fs.rm(CACHE_DIR, { recursive: true, force: true });
|
||||
await run('git', ['clone', '--depth', '1', '--branch', REF, REPO, CACHE_DIR]);
|
||||
} else if (!hasSubmodule) {
|
||||
await run('git', ['submodule', 'update', '--init', '--recursive', 'vendor/ComfyUI_frontend']);
|
||||
}
|
||||
const hasPnpmLock = await fs.access(path.join(DIR, 'pnpm-lock.yaml')).then(() => true, () => false);
|
||||
if (hasPnpmLock) {
|
||||
await run('pnpm', ['install', '--frozen-lockfile'], { cwd: DIR });
|
||||
|
||||
+1
Submodule vendor/ComfyUI_frontend added at d405002127
Reference in New Issue
Block a user