Skip to content

Commit 009f12e

Browse files
authored
Merge branch 'main' into fr/fix-publish
2 parents 90ad996 + fb2d080 commit 009f12e

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/pyscript/_generator.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,17 @@ def create_project(
109109
if not pyscript_version:
110110
pyscript_version = _get_latest_pyscript_version()
111111

112+
if project_type == "app":
113+
template = "basic.html"
114+
else:
115+
raise ValueError(
116+
f"Unknown project type: {project_type}. Valid values are: 'app'"
117+
)
118+
112119
context = {
113120
"name": app_name,
114121
"description": app_description,
115-
"type": "app",
122+
"type": project_type,
116123
"author_name": author_name,
117124
"author_email": author_email,
118125
"version": "latest",
@@ -125,13 +132,6 @@ def create_project(
125132
save_config_file(manifest_file, context)
126133
output_path = app_dir / "index.html" if output is None else app_dir / output
127134

128-
if project_type == "app":
129-
template = "basic.html"
130-
else:
131-
raise ValueError(
132-
f"Unknown project type: {project_type}. Valid values are: 'app'"
133-
)
134-
135135
python_filepath = app_dir / "main.py"
136136

137137
if not wrap:

tests/test_cli.py

+10
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ def test_create_command(
7272
assert 'author_email = ""' in config_text
7373

7474

75+
def test_create_command_bad_app_type(
76+
invoke_cli: CLIInvoker, tmp_path: Path, app_details_args: list[str], auto_enter
77+
) -> None:
78+
result = invoke_cli("create", "myapp", "--project-type", "bad_type")
79+
assert (
80+
str(result.exception)
81+
== "Unknown project type: bad_type. Valid values are: 'app'"
82+
)
83+
84+
7585
def test_create_command_no_app_name(
7686
invoke_cli: CLIInvoker, tmp_path: Path, app_details_args: list[str], auto_enter
7787
) -> None:

0 commit comments

Comments
 (0)