Add development setup script

This commit is contained in:
ComfyUI_FindModels
2026-07-06 19:18:54 +08:00
parent 85abea174c
commit ffb9740fc0
3 changed files with 124 additions and 1 deletions
+40 -1
View File
@@ -65,7 +65,15 @@ No extra Python packages are required.
## GitHub Sync
Use these commands on another computer for first-time setup:
### First-time setup on another computer
Install these tools first:
- [Git for Windows](https://git-scm.com/download/win)
- Python 3.10 or newer
- Node.js, optional but recommended for frontend syntax checks
Clone the project into ComfyUI's `custom_nodes` folder:
```powershell
cd path\to\ComfyUI\custom_nodes
@@ -73,6 +81,35 @@ git clone https://github.com/mclaughlinrosemary927/ComfyUI_FindModels.git
cd ComfyUI_FindModels
```
Run the local development check:
```powershell
.\scripts\setup-dev.bat
```
Restart ComfyUI after the clone. If the browser already has ComfyUI open, press
`Ctrl+F5` once so the frontend extension is loaded fresh.
### Daily workflow
Before editing on a computer, pull the latest code:
```powershell
.\scripts\pull.bat
```
After editing, run the environment check:
```powershell
.\scripts\setup-dev.bat
```
Then upload your changes:
```powershell
.\scripts\push.bat
```
Daily pull from GitHub:
```powershell
@@ -94,6 +131,8 @@ powershell -ExecutionPolicy Bypass -File .\scripts\push.ps1 "Fix model detection
The upload script runs the Python tests, checks `web/find_models.js`, stages all tracked
and untracked project files, commits, and pushes. The pull script refuses to pull when
there are local uncommitted changes, so work on another computer is not overwritten.
The setup script checks Git, Python, optional Node.js, Python tests, frontend syntax,
Python syntax, and whitespace.
Local runtime files such as `models/`, `external_model_folder.json`, `quark_auth.json`,
`__pycache__/`, and `.pytest_cache/` are intentionally ignored and are not uploaded.
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0setup-dev.ps1" %*
if errorlevel 1 (
echo.
echo Development environment check failed. Check the messages above.
pause
exit /b 1
)
echo.
echo Development environment check complete.
pause
+72
View File
@@ -0,0 +1,72 @@
$ErrorActionPreference = "Stop"
$repo = Resolve-Path (Join-Path $PSScriptRoot "..")
Set-Location $repo
function Test-Command {
param([string]$Name)
$command = Get-Command $Name -ErrorAction SilentlyContinue
if ($command) {
Write-Host "[OK] $Name -> $($command.Source)"
return $true
}
Write-Host "[MISSING] $Name is not available in PATH" -ForegroundColor Yellow
return $false
}
Write-Host "ComfyUI_FindModels development environment check"
Write-Host "Repository: $repo"
Write-Host ""
$ok = $true
$ok = (Test-Command "git") -and $ok
$ok = (Test-Command "python") -and $ok
$nodeOk = Test-Command "node"
Write-Host ""
Write-Host "Git status:"
git status --short --branch
Write-Host ""
Write-Host "Python version:"
python --version
if ($nodeOk) {
Write-Host ""
Write-Host "Node version:"
node --version
} else {
Write-Host ""
Write-Host "Node.js is optional for running the ComfyUI plugin, but required for 'node --check web\\find_models.js'." -ForegroundColor Yellow
}
Write-Host ""
Write-Host "Running Python tests..."
python -m unittest discover -s tests
if ($nodeOk) {
Write-Host ""
Write-Host "Checking frontend syntax..."
node --check web\find_models.js
}
Write-Host ""
Write-Host "Checking Python syntax..."
python -B -c "import ast, pathlib; [ast.parse(p.read_text(encoding='utf-8')) for p in map(pathlib.Path, ['model_finder.py','find_models.py','node_installer.py','__init__.py'])]; print('python syntax ok')"
Write-Host ""
Write-Host "Checking whitespace..."
git diff --check
if (-not $ok) {
Write-Host ""
Write-Host "Required tools are missing. Install Git and Python, then run this script again." -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "Development environment check complete."
Write-Host "Next steps:"
Write-Host " 1. Restart ComfyUI after changing Python or frontend files."
Write-Host " 2. Press Ctrl+F5 in the browser after changing web/find_models.js."
Write-Host " 3. Use scripts\\pull.bat before editing on another computer."
Write-Host " 4. Use scripts\\push.bat after testing your changes."