Skip to content

Commit ac1c649

Browse files
authored
Verify electron build after yarn:make (#642)
* Verify build for mac and windows. * Install uv as part of make process. * Remove extra download uv command. * Fix command. * add .exe suffix for windows
1 parent cd44681 commit ac1c649

File tree

6 files changed

+65
-11
lines changed

6 files changed

+65
-11
lines changed

.github/actions/build/todesktop/action.yml

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ runs:
2929
shell: bash
3030
- run: yarn set version --yarn-path self
3131
shell: bash
32-
- run: yarn run download:uv all
33-
shell: bash
3432
- name: Set up Python
3533
uses: actions/setup-python@v4
3634
with:

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ First, initialize the application resources by running `yarn make:assets`:
172172

173173
This command will install ComfyUI and ComfyUI-Manager under `assets/`. The exact versions of each package is defined in `package.json`.
174174

175-
Second, you need to install `uv`. This will be bundled with the distributable, but we also need it locally.
176-
177-
```bash
178-
yarn download:uv
179-
```
180-
181175
You can then run `start` to build/launch the code and a live buildserver that will automatically rebuild the code on any changes:
182176

183177
```bash

builder-debug.config.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const debugConfig: Configuration = {
44
files: ['node_modules', 'package.json', '.vite/**'],
55
extraResources: [
66
{ from: './assets/ComfyUI', to: 'ComfyUI' },
7-
{ from: './assets/uv/uv', to: 'uv/uv' },
8-
{ from: './assets/uv/uvx', to: 'uv/uvx' },
7+
{ from: './assets/uv', to: 'uv' },
98
{ from: './assets/UI', to: 'UI' },
109
],
1110
beforeBuild: './scripts/preMake.js',

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"format:fix": "prettier --write .",
2929
"lint": "eslint src",
3030
"lint:fix": "eslint --fix src",
31-
"make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts",
31+
"make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts && yarn run verify:build",
3232
"make:assets": "node scripts/makeComfy.js",
3333
"make:nvidia": "yarn run make -- --nvidia",
3434
"notarize": "node debug/notarize.js",
@@ -45,6 +45,7 @@
4545
"todesktop:afterPack": "./scripts/todesktop/afterPack.cjs",
4646
"todesktop:beforeInstall": "./scripts/todesktop/beforeInstall.cjs",
4747
"typescript": "tsc -p tsconfig.build.json",
48+
"verify:build": "node scripts/verifyBuild.js",
4849
"vite:compile": "yarn run typescript && vite build && vite build --config vite.preload.config.ts",
4950
"vite:types": "yarn run typescript && vite build --config vite.types.config.ts && node scripts/prepareTypes.js",
5051
"release:types": "node scripts/releaseTypes.js",

scripts/makeComfy.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ execSync(`git clone ${comfyRepo} --depth 1 --branch v${pkg.config.comfyVersion}
99
execSync(`git clone ${managerRepo} assets/ComfyUI/custom_nodes/ComfyUI-Manager`);
1010
execSync(`cd assets/ComfyUI/custom_nodes/ComfyUI-Manager && git checkout ${pkg.config.managerCommit} && cd ../../..`);
1111
execSync(`yarn run make:frontend`);
12+
execSync(`yarn run download:uv all`);

scripts/verifyBuild.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
3+
import fs from 'node:fs';
4+
import path from 'node:path';
5+
6+
/**
7+
* Verify the app build for the current platform.
8+
* Check that all required paths are present.
9+
*/
10+
const PATHS = {
11+
mac: {
12+
base: 'dist/mac-arm64/ComfyUI.app/Contents/Resources',
13+
required: ['ComfyUI', 'ComfyUI/custom_nodes/ComfyUI-Manager', 'UI', 'uv/macos/uv', 'uv/macos/uvx'],
14+
},
15+
windows: {
16+
base: 'dist/win-unpacked/resources',
17+
required: [
18+
// Add Windows-specific paths here
19+
'ComfyUI',
20+
'ComfyUI/custom_nodes/ComfyUI-Manager',
21+
'UI',
22+
'uv/win/uv.exe',
23+
'uv/win/uvx.exe',
24+
],
25+
},
26+
};
27+
28+
function verifyConfig(config) {
29+
const missingPaths = [];
30+
31+
for (const requiredPath of config.required) {
32+
const fullPath = path.join(config.base, requiredPath);
33+
if (!fs.existsSync(fullPath)) {
34+
missingPaths.push(requiredPath);
35+
}
36+
}
37+
38+
if (missingPaths.length > 0) {
39+
console.error('❌ Build verification failed!');
40+
console.error('Missing required paths:');
41+
for (const p of missingPaths) console.error(` - ${p}`);
42+
process.exit(1);
43+
}
44+
}
45+
46+
function verifyBuild() {
47+
const platform = process.platform;
48+
49+
if (platform === 'darwin') {
50+
console.log('🔍 Verifying build for Macos...');
51+
verifyConfig(PATHS.mac);
52+
} else if (platform === 'win32') {
53+
console.log('🔍 Verifying build for Windows...');
54+
verifyConfig(PATHS.windows);
55+
} else {
56+
console.error('❌ Unsupported platform:', platform);
57+
process.exit(1);
58+
}
59+
}
60+
61+
verifyBuild();

0 commit comments

Comments
 (0)