feat(src/djinit/ui): add Vite/React selection support
- Add `UIFormatter.get_vite_choice()` to prompt inclusion of Vite/React via django‑vite - Introduce `use_vite` flag in `StructureOptions`, store it in metadata, and propagate to scaffolding templates - Update CLI prompts and final project summary to display Vite/React confirmation - Extend usage of the flag throughout app generation to honor the selected frontend stack
This commit is contained in:
1 file changed
+12
@@ -184,6 +184,9 @@ class InputCollector:
|
||||
def get_docker_choice(self) -> bool:
|
||||
return UIFormatter.confirm("Include Docker support? (Dockerfile + docker-compose)", default=True)
|
||||
|
||||
def get_vite_choice(self) -> bool:
|
||||
return UIFormatter.confirm("Include Vite/React? (via django-vite)", default=True)
|
||||
|
||||
def _get_structure_metadata(self, options: StructureOptions) -> Tuple[str, str, list[str], dict]:
|
||||
"""Helper method to generate metadata dictionary."""
|
||||
project_dir = options["project_dir"]
|
||||
@@ -209,6 +212,7 @@ class InputCollector:
|
||||
use_tailwind=options.get("use_tailwind", False),
|
||||
use_htmx=options.get("use_htmx", False),
|
||||
use_docker=options.get("use_docker", False),
|
||||
use_vite=options.get("use_vite", False),
|
||||
predefined_structure=options["predefined"],
|
||||
unified_structure=options["unified"],
|
||||
single_structure=options["single"],
|
||||
@@ -273,6 +277,9 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
|
||||
# Step 4: Docker
|
||||
use_docker = collector.get_docker_choice()
|
||||
|
||||
# Step 5: Vite/React
|
||||
use_vite = collector.get_vite_choice()
|
||||
|
||||
# Step 3: Django Apps (Standard only)
|
||||
nested = False
|
||||
nested_dir = None
|
||||
@@ -299,6 +306,7 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
|
||||
use_tailwind=use_tailwind,
|
||||
use_htmx=use_htmx,
|
||||
use_docker=use_docker,
|
||||
use_vite=use_vite,
|
||||
)
|
||||
return project_dir, project_name, app_names[0], app_names, metadata.to_dict()
|
||||
else:
|
||||
@@ -313,6 +321,7 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
|
||||
use_tailwind=use_tailwind,
|
||||
use_htmx=use_htmx,
|
||||
use_docker=use_docker,
|
||||
use_vite=use_vite,
|
||||
use_github=use_github,
|
||||
use_gitlab=use_gitlab,
|
||||
)
|
||||
@@ -354,6 +363,9 @@ def confirm_setup(project_dir: str, project_name: str, app_names: list, metadata
|
||||
use_docker = "Yes" if metadata.get("use_docker", False) else "No"
|
||||
console.print(f"[{UIColors.HIGHLIGHT}]Docker:[/{UIColors.HIGHLIGHT}] {use_docker}")
|
||||
|
||||
use_vite = "Yes" if metadata.get("use_vite", False) else "No"
|
||||
console.print(f"[{UIColors.HIGHLIGHT}]Vite/React:[/{UIColors.HIGHLIGHT}] {use_vite}")
|
||||
|
||||
console.print()
|
||||
UIFormatter.print_separator()
|
||||
console.print()
|
||||
|
||||
Reference in new issue
Block a user