Added node package bumping to bump script

This commit is contained in:
Donkie
2023-12-29 00:14:26 +01:00
parent 42155b0121
commit 315ff1d980

View File

@@ -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)