From a2ea5502e60c01f1266d3ef25d0294ce50763cb3 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 16 Jan 2025 11:43:36 -0800 Subject: [PATCH 1/5] Verify build for mac and windows. --- builder-debug.config.ts | 3 +- package.json | 3 +- scripts/verifyBuild.js | 61 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 scripts/verifyBuild.js diff --git a/builder-debug.config.ts b/builder-debug.config.ts index 777d31c8..ba9602d2 100644 --- a/builder-debug.config.ts +++ b/builder-debug.config.ts @@ -4,8 +4,7 @@ const debugConfig: Configuration = { files: ['node_modules', 'package.json', '.vite/**'], extraResources: [ { from: './assets/ComfyUI', to: 'ComfyUI' }, - { from: './assets/uv/uv', to: 'uv/uv' }, - { from: './assets/uv/uvx', to: 'uv/uvx' }, + { from: './assets/uv', to: 'uv' }, { from: './assets/UI', to: 'UI' }, ], beforeBuild: './scripts/preMake.js', diff --git a/package.json b/package.json index 3eaa1441..402f7113 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "format:fix": "prettier --write .", "lint": "eslint src", "lint:fix": "eslint --fix src", - "make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts", + "make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts && yarn run verify:build", "make:assets": "node scripts/makeComfy.js", "make:nvidia": "yarn run make -- --nvidia", "notarize": "node debug/notarize.js", @@ -45,6 +45,7 @@ "todesktop:afterPack": "./scripts/todesktop/afterPack.cjs", "todesktop:beforeInstall": "./scripts/todesktop/beforeInstall.cjs", "typescript": "tsc -p tsconfig.build.json", + "verify:build": "node scripts/verifyBuild.js", "vite:compile": "yarn run typescript && vite build && vite build --config vite.preload.config.ts", "vite:types": "yarn run typescript && vite build --config vite.types.config.ts && node scripts/prepareTypes.js", "release:types": "node scripts/releaseTypes.js", diff --git a/scripts/verifyBuild.js b/scripts/verifyBuild.js new file mode 100644 index 00000000..68236d50 --- /dev/null +++ b/scripts/verifyBuild.js @@ -0,0 +1,61 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +import fs from 'node:fs'; +import path from 'node:path'; + +/** + * Verify the app build for the current platform. + * Check that all required paths are present. + */ +const PATHS = { + mac: { + base: 'dist/mac-arm64/ComfyUI.app/Contents/Resources', + required: ['ComfyUI', 'ComfyUI/custom_nodes/ComfyUI-Manager', 'UI', 'uv/macos/uv', 'uv/macos/uvx'], + }, + windows: { + base: 'dist/win-unpacked/resources', + required: [ + // Add Windows-specific paths here + 'ComfyUI', + 'ComfyUI/custom_nodes/ComfyUI-Manager', + 'UI', + 'uv/win/uv', + 'uv/win/uvx', + ], + }, +}; + +function verifyConfig(config) { + const missingPaths = []; + + for (const requiredPath of config.required) { + const fullPath = path.join(config.base, requiredPath); + if (!fs.existsSync(fullPath)) { + missingPaths.push(requiredPath); + } + } + + if (missingPaths.length > 0) { + console.error('❌ Build verification failed!'); + console.error('Missing required paths:'); + for (const p of missingPaths) console.error(` - ${p}`); + process.exit(1); + } +} + +function verifyBuild() { + const platform = process.platform; + + if (platform === 'darwin') { + console.log('🔍 Verifying build for Macos...'); + verifyConfig(PATHS.mac); + } else if (platform === 'win32') { + console.log('🔍 Verifying build for Windows...'); + verifyConfig(PATHS.windows); + } else { + console.error('❌ Unsupported platform:', platform); + process.exit(1); + } +} + +verifyBuild(); From 47504dc1e14b902ba0a1b613bf69f13ef682839e Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 16 Jan 2025 11:47:42 -0800 Subject: [PATCH 2/5] Install uv as part of make process. --- scripts/makeComfy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/makeComfy.js b/scripts/makeComfy.js index 7e1feec3..c9862ca2 100644 --- a/scripts/makeComfy.js +++ b/scripts/makeComfy.js @@ -9,3 +9,4 @@ execSync(`git clone ${comfyRepo} --depth 1 --branch v${pkg.config.comfyVersion} execSync(`git clone ${managerRepo} assets/ComfyUI/custom_nodes/ComfyUI-Manager`); execSync(`cd assets/ComfyUI/custom_nodes/ComfyUI-Manager && git checkout ${pkg.config.managerCommit} && cd ../../..`); execSync(`yarn run make:frontend`); +execSync(`yarn run make:download-uv all`); From 6e2994cefe162338475a2a73d78f5d9448411f57 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 16 Jan 2025 11:50:19 -0800 Subject: [PATCH 3/5] Remove extra download uv command. --- .github/actions/build/todesktop/action.yml | 2 -- README.md | 6 ------ 2 files changed, 8 deletions(-) diff --git a/.github/actions/build/todesktop/action.yml b/.github/actions/build/todesktop/action.yml index e546948c..b36f609c 100644 --- a/.github/actions/build/todesktop/action.yml +++ b/.github/actions/build/todesktop/action.yml @@ -29,8 +29,6 @@ runs: shell: bash - run: yarn set version --yarn-path self shell: bash - - run: yarn run download:uv all - shell: bash - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/README.md b/README.md index ab51bf15..df344d51 100644 --- a/README.md +++ b/README.md @@ -172,12 +172,6 @@ First, initialize the application resources by running `yarn make:assets`: This command will install ComfyUI and ComfyUI-Manager under `assets/`. The exact versions of each package is defined in `package.json`. -Second, you need to install `uv`. This will be bundled with the distributable, but we also need it locally. - -```bash -yarn download:uv -``` - You can then run `start` to build/launch the code and a live buildserver that will automatically rebuild the code on any changes: ```bash From 343fda4e8f5a9e14b5801bdd90e8da66924fd47f Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 16 Jan 2025 12:51:46 -0800 Subject: [PATCH 4/5] Fix command. --- scripts/makeComfy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makeComfy.js b/scripts/makeComfy.js index c9862ca2..ce82d7c2 100644 --- a/scripts/makeComfy.js +++ b/scripts/makeComfy.js @@ -9,4 +9,4 @@ execSync(`git clone ${comfyRepo} --depth 1 --branch v${pkg.config.comfyVersion} execSync(`git clone ${managerRepo} assets/ComfyUI/custom_nodes/ComfyUI-Manager`); execSync(`cd assets/ComfyUI/custom_nodes/ComfyUI-Manager && git checkout ${pkg.config.managerCommit} && cd ../../..`); execSync(`yarn run make:frontend`); -execSync(`yarn run make:download-uv all`); +execSync(`yarn run download:uv all`); From 8e10e43251fb64763b3aea3e4ec9fedb243d5660 Mon Sep 17 00:00:00 2001 From: robinjhuang Date: Thu, 16 Jan 2025 15:55:43 -0800 Subject: [PATCH 5/5] add .exe suffix for windows --- scripts/verifyBuild.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/verifyBuild.js b/scripts/verifyBuild.js index 68236d50..9902b28c 100644 --- a/scripts/verifyBuild.js +++ b/scripts/verifyBuild.js @@ -19,8 +19,8 @@ const PATHS = { 'ComfyUI', 'ComfyUI/custom_nodes/ComfyUI-Manager', 'UI', - 'uv/win/uv', - 'uv/win/uvx', + 'uv/win/uv.exe', + 'uv/win/uvx.exe', ], }, };