diff --git a/.gitignore b/.gitignore index 6a2c5cec..0465e8c3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ typings/ # TypeScript cache *.tsbuildinfo +dist # Optional npm cache directory .npm @@ -57,6 +58,9 @@ typings/ # Yarn Integrity file .yarn-integrity +# Yarn cache files +.yarn + # dotenv environment variables file .env .env.test @@ -95,6 +99,9 @@ out/ comfyui-prebuilt comfyui +# vscode +*.code-workspace +.history .vscode/* assets/ComfyUI diff --git a/forge.config.ts b/forge.config.ts index 03cc1453..9ad1a712 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -15,7 +15,7 @@ const config: ForgeConfig = { debug:true, hookFunction: (filePath) => { if (!filePath.endsWith("ComfyUI.exe")) return; // For now just ignore any file that isnt the main exe will need to change when building with installers/auto updates / a compiled python servesr - require("child_process").execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`) + import("child_process").then(cp => cp.execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`)); }, }}, osxSign: { @@ -25,12 +25,12 @@ const config: ForgeConfig = { return { entitlements: './assets/entitlements.mac.plist' }; } }, - extraResource: ['./assets/UI', './assets/ComfyUI', './assets/python'], + extraResource: ['./assets/UI', './assets/ComfyUI', process.platform === 'darwin' ? './assets/python' : './assets/python.tgz'], osxNotarize: { appleId: process.env.APPLE_ID, appleIdPassword: process.env.APPLE_PASSWORD, teamId: process.env.APPLE_TEAM_ID - } + }, }, rebuildConfig: {}, hooks: { @@ -44,8 +44,17 @@ const config: ForgeConfig = { }, makers: [ new MakerZIP({}, ['darwin', 'win32']), - new MakerRpm({}), - new MakerDeb({}), + // the forge build produces a "ComfyUI" bin, but the rpm/deb makers expect a "comfyui-electron" bin (matching the "name" in package.json). We override this below + new MakerRpm({ + options: { + bin: "ComfyUI" + } + }), + new MakerDeb({ + options: { + bin: "ComfyUI" + } + }), ], plugins: [ new VitePlugin({ diff --git a/src/main.ts b/src/main.ts index f04c08c7..58146bf6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,9 +4,13 @@ import net from 'net'; import { spawn, ChildProcess } from 'child_process'; // Handle creating/removing shortcuts on Windows when installing/uninstalling. -if (require('electron-squirrel-startup')) { - app.quit(); -} +import('electron-squirrel-startup').then(ess => { + const {default: check} = ess; + if (check) { + app.quit(); + } +}); + let pythonProcess: ChildProcess | null = null; const host = '127.0.0.1'; // Replace with the desired IP address const port = 8188; // Replace with the port number your server is running on @@ -82,6 +86,10 @@ const launchPythonServer = async () => { executablePath = path.join(process.resourcesPath, 'UI', packagedComfyUIExecutable); pythonProcess = spawn(executablePath, { shell: true }); } + } else { + executablePath = path.join(process.resourcesPath, 'UI', packagedComfyUIExecutable); + pythonProcess = spawn(executablePath, { shell: true }); + } } else { // Development: use the fake Python server if (process.platform == 'darwin') {