-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bundle deterministic frontend at build time (#195)
* Bundle determinstic frontend at build time * nit * nit
- Loading branch information
Showing
3 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,22 +8,27 @@ | |
"description": "The best modular GUI to run AI diffusion models.", | ||
"main": ".vite/build/main.js", | ||
"packageManager": "[email protected]", | ||
"config": { | ||
"frontendVersion": "1.3.33" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf .vite dist out", | ||
"clean:assets": "rimraf assets/.env assets/ComfyUI assets/python.tgz & yarn run clean:assets:dev", | ||
"clean:assets:dev": "yarn run clean:assets:git && rimraf assets/python assets/override.txt & rimraf assets/cpython*.tar.gz & rimraf assets/requirements.*", | ||
"clean:assets:git": "rimraf assets/ComfyUI/.git assets/ComfyUI/custom_nodes/ComfyUI_Manager/.git assets/ComfyUI/custom_nodes/DesktopSettingsExtension/.git", | ||
"clean:slate": "yarn run clean & yarn run clean:assets & rimraf node_modules", | ||
"clone-settings-extension": "git clone https://github.com/Comfy-Org/DesktopSettingsExtension.git assets/ComfyUI/custom_nodes/DesktopSettingsExtension", | ||
"download-frontend": "node scripts/downloadFrontend.js", | ||
"make:frontend": "yarn run download-frontend && yarn run clone-settings-extension", | ||
"format": "prettier --check .", | ||
"format:fix": "prettier --write .", | ||
"lint": "eslint --ext .ts,.tsx .", | ||
"lint:fix": "eslint --fix --ext .ts,.tsx .", | ||
"make": "yarn run vite:compile && electron-builder build --config=builder-debug.config.ts", | ||
"make:assets:amd": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --amd --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension", | ||
"make:assets:cpu": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --cpu --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && node ../scripts/env.mjs && yarn run clone-settings-extension", | ||
"make:assets:macos": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --m-series --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension && ../scripts/checkAssetsMacos.sh python", | ||
"make:assets:nvidia": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --nvidia --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run clone-settings-extension", | ||
"make:assets:amd": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --amd --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run make:frontend", | ||
"make:assets:cpu": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --cpu --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && node ../scripts/env.mjs && yarn run make:frontend", | ||
"make:assets:macos": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --m-series --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run make:frontend && ../scripts/checkAssetsMacos.sh python", | ||
"make:assets:nvidia": "cd assets && comfy-cli --skip-prompt --here install --fast-deps --nvidia --manager-url https://github.com/Comfy-Org/manager-core && comfy-cli --here standalone && yarn run make:frontend", | ||
"make:nvidia": "yarn run make -- --nvidia", | ||
"notarize": "node debug/notarize.js", | ||
"package": "yarn run vite:compile && todesktop build --code-sign=false --async", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const axios = require('axios'); | ||
const extract = require('extract-zip'); | ||
const fs = require('fs/promises'); | ||
const path = require('path'); | ||
|
||
// Example "v1.3.34" | ||
const version = process.argv[2] || require('../package.json').config.frontendVersion; | ||
if (!version) { | ||
console.error('No version specified'); | ||
process.exit(1); | ||
} | ||
|
||
const url = `https://github.com/Comfy-Org/ComfyUI_frontend/releases/download/v${version}/dist.zip`; | ||
const downloadPath = 'temp_frontend.zip'; | ||
const extractPath = 'assets/ComfyUI/web_custom_versions/desktop_app'; | ||
|
||
async function downloadAndExtractFrontend() { | ||
try { | ||
// Create directories if they don't exist | ||
await fs.mkdir(extractPath, { recursive: true }); | ||
|
||
// Download the file | ||
console.log('Downloading frontend...'); | ||
const response = await axios({ | ||
method: 'GET', | ||
url: url, | ||
responseType: 'arraybuffer' | ||
}); | ||
|
||
// Save to temporary file | ||
await fs.writeFile(downloadPath, response.data); | ||
|
||
// Extract the zip file | ||
console.log('Extracting frontend...'); | ||
await extract(downloadPath, { dir: path.resolve(extractPath) }); | ||
|
||
// Clean up temporary file | ||
await fs.unlink(downloadPath); | ||
|
||
console.log('Frontend downloaded and extracted successfully!'); | ||
} catch (error) { | ||
console.error('Error downloading frontend:', error.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
downloadAndExtractFrontend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters