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

Install DesktopSettingsExtension and remove .git directories on mac. #161

Closed
wants to merge 14 commits into from
11 changes: 3 additions & 8 deletions .github/actions/build/macos/comfy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ runs:
- name: Make Standalone
shell: sh
run: |
python -m pip install --upgrade pip
pip install comfy-cli
cd assets
comfy --skip-prompt --here install --fast-deps --m-series --manager-url https://github.com/Comfy-Org/manager-core
cd ComfyUI
cd ../
comfy --here standalone --platform macos
comfy standalone --rehydrate
pip install --upgrade pip
pip install --upgrade comfy-cli
yarn make:assets:macos
- name: Unzip Sign Lib/Bin Rezip
if: ${{inputs.sign-and-publish == 'true'}}
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/build/windows/todesktop/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows Build to ToDesktop
name: Build to ToDesktop
description: Will build the project then send the project files to ToDesktop to be compiled into installers.
inputs:
GITHUB_TOKEN:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_all.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish All Platforms
name: Publish App to ToDesktop

on:
workflow_dispatch:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/todesktop.yml

This file was deleted.

2 changes: 1 addition & 1 deletion builder-debug.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Configuration } from 'electron-builder';

const debugConfig: Configuration = {
files: ['package.json', 'README.md', 'src/**', '.vite/**'],
files: ['package.json', 'README.md', 'src/**', '.vite/**', 'node_modules/**'],
extraFiles: [{ from: './assets', to: process.platform === 'darwin' ? './Resources' : './resources' }],
beforeBuild: './scripts/preMake.js',
win: {
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@
"@electron/windows-sign": "^1.1.3",
"@playwright/test": "^1.47.2",
"@sentry/wizard": "^3.30.0",
"@todesktop/cli": "^1.9.7",
"@todesktop/cli": "^1.10.1",
"@types/adm-zip": "^0.5.5",
"@types/electron-squirrel-startup": "^1.0.2",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.0",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/tar": "6.1.13",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"electron": "31.3.1",
Expand Down Expand Up @@ -90,8 +89,6 @@
"react-dom": "^18.3.1",
"systeminformation": "^5.23.5",
"tar": "^7.4.3",
"update-electron-app": "^3.0.0",
"ws": "^8.18.0",
"yaml": "^2.6.0"
},
"lint-staged": {
Expand Down
5 changes: 3 additions & 2 deletions scripts/todesktop/afterPack.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ module.exports = async ({ appOutDir, packager, outDir }) => {
const assetPath = path.join(mainPath, 'app-wrapper', 'app', 'assets');
const resourcePath = path.join(appPath, "Contents", "Resources");
const result = await fs.rm(path.join(assetPath, "ComfyUI", ".git"), { recursive: true, force: true });
const result3 = await fs.rm(path.join(assetPath, "ComfyUI", "custom_nodes","ComfyUI-Manager",".git"), { recursive: true, force: true });
const result2 = await fs.cp(assetPath, resourcePath, { recursive: true });
}

if (os.platform() === 'win32') {
const appName = packager.appInfo.productFilename;
const appPath = path.join(`${appOutDir}`, `${appName}.exe`);
Expand All @@ -34,4 +35,4 @@ module.exports = async ({ appOutDir, packager, outDir }) => {
const resourcePath = path.join(path.dirname(appPath), "resources");
await fs.cp(assetPath, resourcePath, { recursive: true });
}
}
}
27 changes: 18 additions & 9 deletions scripts/todesktop/postInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { spawnSync } = require("child_process");
const path = require("path");
const os = require('os');
const process = require("process");
//const fs = require('fs-extra');

async function postInstall() {
const firstInstallOnToDesktopServers =
Expand All @@ -24,21 +23,31 @@ async function postInstall() {

if (os.platform() === "darwin") {

const resultUpgradePip = spawnSync(`py`, ['-3.12', '-m', 'pip' ,'install' ,'--upgrade pip'],{shell:true,stdio: 'ignore'}).toString();
const resultInstallComfyCLI = spawnSync(`py`, ['-3.12 ','-m' ,'pip' ,'install comfy-cli'], {shell:true,stdio: 'ignore'}).toString();
const resultComfyManagerInstall = spawnSync('yarn run make:assets:macos' ,[''],{shell:true,stdio: 'inherit'}).toString();
const resultUpgradePip = spawnSync(`python3`, ['-m', 'pip' ,'install' ,'--upgrade pip'],{shell:true,stdio: 'ignore'});
const resultInstallComfyCLI = spawnSync(`python3`, ['-m' ,'pip' ,'install comfy-cli'], {shell:true,stdio: 'ignore'});
const resultComfyManagerInstall = spawnSync('yarn run make:assets:macos' ,[''],{shell:true,stdio: 'inherit'});

// Do not delete, useful if there are build issues with mac
// TODO: Consider making a global build log as ToDesktop logs can be hit or miss
/*
fs.createFileSync('./src/macpip.txt');
fs.writeFileSync('./src/macpip.txt',JSON.stringify({
log: result.stdout.toString(),
err:result.stderr.toString()
const fs = require('fs-extra');
fs.createFileSync('./.vite/macpip.json');
fs.writeFileSync('./.vite/macpip.json',JSON.stringify({
upgradeOut: {
log: resultUpgradePip.stdout?.toString(),
err:resultUpgradePip.stderr?.toString()},
installComfOut: {
log: resultInstallComfyCLI.stdout?.toString(),
err:resultInstallComfyCLI.stderr?.toString()
},
ComfManInstallOut: {
log: resultComfyManagerInstall.stdout?.toString(),
err:resultComfyManagerInstall.stderr?.toString()
}
}));
*/
console.log("Finish Python & Comfy Install for Mac");
}
};

postInstall();
postInstall();
8 changes: 0 additions & 8 deletions src/__tests__/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ jest.mock('electron-log/main', () => ({
// Add other methods you might use from electron-log
}));

// Mock the update-electron-app module
jest.mock('update-electron-app', () => ({
updateElectronApp: jest.fn(),
UpdateSourceType: {
StaticStorage: 'StaticStorage',
},
}));

describe('createWindow', () => {
// it('should create a new BrowserWindow with correct options', async () => {
// const window = await createWindow('/');
Expand Down
3 changes: 0 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { spawn, ChildProcess } from 'node:child_process';
import * as fsPromises from 'node:fs/promises';
import fs from 'fs';
import axios from 'axios';
import path from 'node:path';
Expand All @@ -18,7 +17,6 @@ import Store from 'electron-store';
import * as net from 'net';
import { graphics } from 'systeminformation';
import { createModelConfigFiles, readBasePathFromConfig } from './config/extra_model_config';
import { WebSocketServer } from 'ws';
import { StoreType } from './store';
import todesktop from '@todesktop/runtime';
import { PythonEnvironment } from './pythonEnvironment';
Expand All @@ -31,7 +29,6 @@ let isRestarting: boolean = false; // Prevents double restarts TODO(robinhuang):
const host = '127.0.0.1';
let port = 8188;
let mainWindow: BrowserWindow | null = null;
let wss: WebSocketServer | null;
let store: Store<StoreType> | null = null;
const messageQueue: Array<any> = []; // Stores mesaages before renderer is ready.
let downloadManager: DownloadManager;
Expand Down
11 changes: 1 addition & 10 deletions todesktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,5 @@
"appPath": ".",
"appFiles": ["src/**", "scripts/**", "assets/**", "dist/**", ".vite/**", ".yarnrc.yml", ".yarn/**"],
"extraResources": [{ "from": "./assets" }],
"filesForDistribution": ["!assets/**", "!dist/**", "!src/**", "!scripts/**", "!.yarn/**", "!.yarnrc.yml"],
"mac": {
"additionalBinariesToSign": [
"./assets/output/lib/libpython3.12.dylib",
"./assets/output/lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so",
"./assets/output/bin/uv",
"./assets/output/bin/uvx",
"./assets/output/bin/python3.12"
]
}
"filesForDistribution": ["!assets/**", "!dist/**", "!src/**", "!scripts/**", "!.yarn/**", "!.yarnrc.yml"]
}
Loading
Loading