INNER CODE UNIT · Python
update_config_json_dep
jpush/jpush-react-native · .claude/skills/update-sdk/scripts/plugin_updater.py:171
def update_config_json_dep(file_path: str, dep_prefix: str, new_version: str) -> bool:
"""Update a maven dependency version in a UTS config.json dependencies array."""
path = Path(file_path)
if not path.exists():
print(f" WARNING: File not found: {file_path}")
return False
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
deps = data.get("dependencies", [])
updated = False
for i, dep in enumerate(deps):
if isinstance(dep, str) and dep.startswith(dep_prefix):
old = dep
parts = dep.rsplit(":", 1)
deps[i] = f"{parts[0]}:{new_version}"
print(f" UPDATED: {file_path} dep {old} → {deps[i]}")