Skip to content

Commit 18929bf

Browse files
author
huxiaoyu.612
committed
feat: take web project as template,init command support template type
1 parent 6188f82 commit 18929bf

File tree

19 files changed

+35
-1037
lines changed

19 files changed

+35
-1037
lines changed

veadk/cli/cli_init.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ def _render_prompts() -> dict[str, Any]:
6464

6565

6666
@click.command()
67-
def init() -> None:
67+
@click.option(
68+
"--vefaas-template-type", default="template", help="Expected template type"
69+
)
70+
def init(
71+
vefaas_template_type: str,
72+
) -> None:
6873
"""Init a veadk project that can be deployed to Volcengine VeFaaS."""
6974
import shutil
7075
from pathlib import Path
@@ -73,9 +78,14 @@ def init() -> None:
7378

7479
import veadk.integrations.ve_faas as vefaas
7580

76-
click.echo(
77-
"Welcome use VeADK to create your project. We will generate a `weather-reporter` application for you."
78-
)
81+
if vefaas_template_type == "web_template":
82+
click.echo(
83+
"Welcome use VeADK to create your project. We will generate a `simple-blog` web application for you."
84+
)
85+
else:
86+
click.echo(
87+
"Welcome use VeADK to create your project. We will generate a `weather-reporter` application for you."
88+
)
7989

8090
cwd = Path.cwd()
8191
local_dir_name = click.prompt("Local directory name", default="veadk-cloud-proj")
@@ -91,7 +101,10 @@ def init() -> None:
91101
settings = _render_prompts()
92102
settings["local_dir_name"] = local_dir_name
93103

94-
template_dir_path = Path(vefaas.__file__).parent / "template"
104+
if not vefaas_template_type:
105+
vefaas_template_type = "template"
106+
107+
template_dir_path = Path(vefaas.__file__).parent / vefaas_template_type
95108

96109
cookiecutter(
97110
template=str(template_dir_path),

veadk/integrations/ve_faas/template/web/.dockerignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

veadk/integrations/ve_faas/template/web/.gitignore

Lines changed: 0 additions & 207 deletions
This file was deleted.

veadk/integrations/ve_faas/template/web/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)