Skip to content

Commit 77a66d0

Browse files
Merge pull request #7 from Comfy-Org/vue-template
add vue template
2 parents db6cfd9 + c54072d commit 77a66d0

6 files changed

Lines changed: 51 additions & 4 deletions

File tree

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[submodule "{{cookiecutter.project_slug}}/react-extension-template"]
22
path = {{cookiecutter.project_slug}}/react-extension-template
33
url = https://github.com/Comfy-Org/ComfyUI-React-Extension-Template
4+
5+
[submodule "{{cookiecutter.project_slug}}/vue-basic-template"]
6+
path = {{cookiecutter.project_slug}}/vue-basic-template
7+
url = https://github.com/jtydhr88/ComfyUI_frontend_vue_basic

cookiecutter.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
"full_name": "",
33
"email": "you@gmail.com",
44
"github_username": "your_github_username",
5-
"frontend_type": ["no", "react", "js"],
5+
"frontend_type": ["no", "react", "vue", "js"],
66
"project_name": "My Custom Nodepack",
77
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_').replace('comfyui_', '').replace('comfy_', '') }}",
88
"project_short_description": "A collection of custom nodes for ComfyUI",
99
"version": "0.0.1",
1010
"open_source_license": ["GNU General Public License v3", "MIT license", "BSD license", "ISC license", "Apache Software License 2.0", "Not open source"],
1111
"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}",
12-
"_copy_without_render": ["*.tsx", "*.ts", "*.yml"],
12+
"_copy_without_render": ["*.tsx", "*.ts", "*.yml", "*.vue", "*.mts"],
1313
"__prompts__": {
1414
"frontend_type": {
1515
"__prompt__": "Do you want to write frontend components?",
1616
"no": "No",
1717
"react": "Yes, using React",
18+
"vue": "Yes, using Vue (requires ComfyUI Frontend 1.24.3+)",
1819
"js": "Yes, my own way"
1920
}
2021
}

hooks/post_gen_project.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def setup_project_structure():
6464
shutil.rmtree("react-extension-template")
6565
print("✓ Removed react-extension-template directory")
6666

67+
if Pth("vue-basic-template").exists():
68+
shutil.rmtree("vue-basic-template")
69+
print("✓ Removed vue-basic-template directory")
70+
6771
elif frontend_type == "react":
6872
if Pth("react-extension-template").exists():
6973
print("✓ Found react-extension-template directory")
@@ -102,14 +106,47 @@ def setup_project_structure():
102106
shutil.rmtree("custom-nodes-template")
103107
print("✓ Removed custom-nodes-template directory")
104108

109+
elif frontend_type == "vue":
110+
if Pth("vue-basic-template").exists():
111+
print("✓ Found vue-basic-template directory")
112+
for item in Pth("vue-basic-template").iterdir():
113+
# Skip git-related files when copying from react template
114+
if item.name in [".git", ".gitmodules", ".gitignore"]:
115+
continue
116+
117+
target = Pth(item.name)
118+
if item.is_file():
119+
shutil.copy2(item, target)
120+
print(f"✓ Copied file: {item} -> {target}")
121+
else:
122+
if target.exists():
123+
shutil.rmtree(target)
124+
shutil.copytree(item, target, ignore=shutil.ignore_patterns('.git', '.gitmodules', ".gitignore"))
125+
print(f"✓ Copied directory: {item} -> {target}")
126+
127+
files_to_replace = [
128+
"README.md",
129+
]
130+
131+
replacements = {
132+
"ComfyUI Frontend Vue Basic": "{{cookiecutter.project_name}}",
133+
"MIT License": "{{cookiecutter.open_source_license}}",
134+
}
135+
136+
replace_text_in_files(files_to_replace, replacements)
137+
138+
if Pth("custom-nodes-template").exists():
139+
shutil.rmtree("custom-nodes-template")
140+
print("✓ Removed custom-nodes-template directory")
141+
105142
if Pth("common").exists():
106143
print("✓ Found common directory")
107144
for item in Pth("common").iterdir():
108145
if item.is_file():
109146
shutil.copy2(item, ".")
110147
print(f"✓ Copied common file: {item}")
111148

112-
for template_dir in ["common", "custom-nodes-template", "react-extension-template"]:
149+
for template_dir in ["common", "custom-nodes-template", "react-extension-template", "vue-basic-template"]:
113150
if Pth(template_dir).exists():
114151
shutil.rmtree(template_dir)
115152
print(f"✓ Cleaned up: {template_dir}")

hooks/pre_gen_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def validate_project_name():
6161
template_source = "{{ cookiecutter._template }}"
6262
frontend_type = "{{cookiecutter.frontend_type}}"
6363

64-
if template_source.startswith("gh:") and frontend_type == "react":
64+
if template_source.startswith("gh:") and (frontend_type == "react" or frontend_type == "vue"):
6565
submodule_success = init_submodules()
6666

6767
if not submodule_success:

{{cookiecutter.project_slug}}/common/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Icon = ""
4141
includes = ["dist/"]
4242
{%- endif %}
4343

44+
{% if cookiecutter.frontend_type == 'vue' -%}
45+
includes = ["js"]
46+
{%- endif %}
47+
4448
[tool.setuptools.package-data]
4549
"*" = ["*.*"]
4650

Submodule vue-basic-template added at 38c9613

0 commit comments

Comments
 (0)