diff --git a/spoolman/bump.py b/spoolman/bump.py index 91289bc..e9140d2 100644 --- a/spoolman/bump.py +++ b/spoolman/bump.py @@ -2,6 +2,7 @@ # ruff: noqa: PLR2004, T201, S603, S607 +import json import re import subprocess import sys @@ -39,8 +40,22 @@ def bump() -> None: sys.exit(1) new_version = new_version_match.group(1) - # Stage the pyproject.toml file - subprocess.run(["git", "add", "pyproject.toml"], cwd=project_root, check=True) + # Update the version number in the node project + with Path("client", "package.json").open("r") as f: + node_package = json.load(f) + node_package["version"] = new_version + with Path("client", "package.json").open("w") as f: + json.dump(node_package, f, indent=2) + + # Run npm install to update the lock file with new version + subprocess.run(["npm", "install"], cwd=project_root.joinpath("client"), check=True, shell=True) # noqa: S602 + + # Stage the changed files + subprocess.run( + ["git", "add", "pyproject.toml", "client/package.json", "client/package-lock.json"], + cwd=project_root, + check=True, + ) # Commit the changes subprocess.run(["git", "commit", "-m", f"Bump version to {new_version}"], cwd=project_root, check=True)