Skip to content

Commit 2ae2e82

Browse files
authored
Add deploy script (#96)
1 parent d1934f2 commit 2ae2e82

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

.env_example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ PLAYWRIGHT_TEST_URL=http://localhost:5173
55
# Proxy target of the local development server
66
# Note: localhost:8188 does not work.
77
DEV_SERVER_COMFYUI_URL=http://127.0.0.1:8188
8+
9+
# The target ComfyUI checkout directory to deploy the frontend code to.
10+
# The dist directory will be copied to {DEPLOY_COMFY_UI_DIR}/custom_web_versions/main/dev
11+
# Add `--front-end-root {DEPLOY_COMFY_UI_DIR}/custom_web_versions/main/dev`
12+
# to ComfyUI launch script to serve the custom web version.
13+
DEPLOY_COMFYUI_DIR=/home/ComfyUI/web

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ core extensions will be loaded.
5252

5353
## Deploy
5454

55-
Copy everything under `dist/` to `ComfyUI/web/` in your ComfyUI checkout.
55+
- Option 1: Set `DEPLOY_COMFYUI_DIR` in `.env` and run `npm run deploy`.
56+
- Option 2: Copy everything under `dist/` to `ComfyUI/web/` in your ComfyUI checkout manually.
5657

5758
## Breaking changes
5859

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "npm run typecheck && vite build",
9+
"deploy": "node scripts/deploy.js",
910
"zipdist": "node scripts/zipdist.js",
1011
"typecheck": "tsc --noEmit",
1112
"format": "prettier --write 'src/**/*.{js,ts,tsx}'",
@@ -23,6 +24,7 @@
2324
"@types/node": "^20.14.8",
2425
"babel-plugin-transform-import-meta": "^2.2.1",
2526
"babel-plugin-transform-rename-import": "^2.3.0",
27+
"fs-extra": "^11.2.0",
2628
"husky": "^9.0.11",
2729
"identity-obj-proxy": "^3.0.0",
2830
"jest": "^29.7.0",

scripts/deploy.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { copy } from 'fs-extra';
2+
import { config } from "dotenv";
3+
config();
4+
5+
const sourceDir = './dist';
6+
const targetDir = process.env.DEPLOY_COMFYUI_DIR;
7+
8+
copy(sourceDir, targetDir)
9+
.then(() => {
10+
console.log(`Directory copied successfully! ${sourceDir} -> ${targetDir}`);
11+
})
12+
.catch((err) => {
13+
console.error('Error copying directory:', err);
14+
});

0 commit comments

Comments
 (0)