Added node package bumping to bump script
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# ruff: noqa: PLR2004, T201, S603, S607
|
# ruff: noqa: PLR2004, T201, S603, S607
|
||||||
|
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -39,8 +40,22 @@ def bump() -> None:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
new_version = new_version_match.group(1)
|
new_version = new_version_match.group(1)
|
||||||
|
|
||||||
# Stage the pyproject.toml file
|
# Update the version number in the node project
|
||||||
subprocess.run(["git", "add", "pyproject.toml"], cwd=project_root, check=True)
|
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
|
# Commit the changes
|
||||||
subprocess.run(["git", "commit", "-m", f"Bump version to {new_version}"], cwd=project_root, check=True)
|
subprocess.run(["git", "commit", "-m", f"Bump version to {new_version}"], cwd=project_root, check=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user