diff --git a/templates.py b/templates.py index 47ff170..2ebabff 100644 --- a/templates.py +++ b/templates.py @@ -121,6 +121,14 @@ def update_message(answers: Path) -> str: return f"chore({scope}): update template to {ref}" if ref else f"chore({scope}): update template" +def refresh_locks(part: str) -> None: + root = Path(part) if Path(part, "Makefile").is_file() else Path() + if (root / "uv.lock").is_file(): + subprocess.run(["uv", "lock", "-q"], cwd=root, check=True) + if (root / "bun.lock").is_file(): + subprocess.run(["bun", "install", "--silent"], cwd=root, check=True) + + def update(args: argparse.Namespace) -> None: answers = sorted(Path(".copier").glob("*.yml")) if args.parts: @@ -132,6 +140,7 @@ def update(args: argparse.Namespace) -> None: for file in answers: run_update(".", answers_file=str(file), unsafe=True, overwrite=True, skip_answered=not args.ask, defaults=args.defaults, vcs_ref=REF) + refresh_locks(file.stem) if git_dirty(): subprocess.run(["git", "add", "-A"], check=True) subprocess.run(["git", "commit", "-qm", update_message(file)], check=True)