mirror of
https://github.com/jags111/efficiency-nodes-comfyui.git
synced 2026-03-21 21:22:13 -03:00
Change how Web Extensions are Loaded
This change comes from changes made to ComfyUI from commmit https://github.com/comfyanonymous/ComfyUI/pull/1273
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
from .efficiency_nodes import NODE_CLASS_MAPPINGS
|
from .efficiency_nodes import NODE_CLASS_MAPPINGS
|
||||||
|
WEB_DIRECTORY = "js"
|
||||||
__all__ = ['NODE_CLASS_MAPPINGS']
|
__all__ = ['NODE_CLASS_MAPPINGS']
|
||||||
|
|||||||
29
tsc_utils.py
29
tsc_utils.py
@@ -521,33 +521,16 @@ def packages(python_exe=None, versions=False):
|
|||||||
install_packages(my_dir)
|
install_packages(my_dir)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
# Auto install efficiency nodes web extensions '\js\' to 'ComfyUI\web\extensions'
|
# Delete efficiency nodes web extensions from 'ComfyUI\web\extensions'.
|
||||||
|
# PR from https://github.com/comfyanonymous/ComfyUI/pull/1273 now allows defining web extensions through a dir path in
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
# Source and destination directories
|
# Destination directory
|
||||||
source_dir = os.path.join(my_dir, 'js')
|
|
||||||
destination_dir = os.path.join(comfy_dir, 'web', 'extensions', 'efficiency-nodes-comfyui')
|
destination_dir = os.path.join(comfy_dir, 'web', 'extensions', 'efficiency-nodes-comfyui')
|
||||||
|
|
||||||
# Create the destination directory if it doesn't exist
|
# Check if the directory exists and delete it
|
||||||
os.makedirs(destination_dir, exist_ok=True)
|
if os.path.exists(destination_dir):
|
||||||
|
shutil.rmtree(destination_dir)
|
||||||
# Get a list of all .js files in the source directory
|
|
||||||
source_files = [f for f in os.listdir(source_dir) if f.endswith('.js')]
|
|
||||||
|
|
||||||
# Clear files in the destination directory that aren't in the source directory
|
|
||||||
for file_name in os.listdir(destination_dir):
|
|
||||||
if file_name not in source_files and file_name.endswith('.js'):
|
|
||||||
file_path = os.path.join(destination_dir, file_name)
|
|
||||||
os.unlink(file_path)
|
|
||||||
|
|
||||||
# Iterate over all files in the source directory for copying
|
|
||||||
for file_name in source_files:
|
|
||||||
# Full paths for source and destination
|
|
||||||
source_path = os.path.join(source_dir, file_name)
|
|
||||||
destination_path = os.path.join(destination_dir, file_name)
|
|
||||||
|
|
||||||
# Directly copy the file (this will overwrite if the file already exists)
|
|
||||||
shutil.copy2(source_path, destination_path)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
# Establish a websocket connection to communicate with "efficiency-nodes.js" under:
|
# Establish a websocket connection to communicate with "efficiency-nodes.js" under:
|
||||||
|
|||||||
Reference in New Issue
Block a user