fix(update): refresh uv.lock and bun.lock after each part update

This commit is contained in:
hh committed 2026-10-01 02:04:17 +02:00
1 parent 44ce6c04fa
commit 3d85e6f29c
1 file changed
+9
+9
View File
@@ -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" 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: def update(args: argparse.Namespace) -> None:
answers = sorted(Path(".copier").glob("*.yml")) answers = sorted(Path(".copier").glob("*.yml"))
if args.parts: if args.parts:
@@ -132,6 +140,7 @@ def update(args: argparse.Namespace) -> None:
for file in answers: for file in answers:
run_update(".", answers_file=str(file), unsafe=True, overwrite=True, run_update(".", answers_file=str(file), unsafe=True, overwrite=True,
skip_answered=not args.ask, defaults=args.defaults, vcs_ref=REF) skip_answered=not args.ask, defaults=args.defaults, vcs_ref=REF)
refresh_locks(file.stem)
if git_dirty(): if git_dirty():
subprocess.run(["git", "add", "-A"], check=True) subprocess.run(["git", "add", "-A"], check=True)
subprocess.run(["git", "commit", "-qm", update_message(file)], check=True) subprocess.run(["git", "commit", "-qm", update_message(file)], check=True)