Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify electron build after yarn:make #642

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/actions/build/todesktop/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions builder-debug.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions scripts/makeComfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 download:uv all`);
61 changes: 61 additions & 0 deletions scripts/verifyBuild.js
Original file line number Diff line number Diff line change
@@ -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.exe',
'uv/win/uvx.exe',
],
},
};

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();
Loading