Release v0.1.15
This commit is contained in:
@@ -94,9 +94,6 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
|
||||
cp "$WEBUI/package.release.json" "$TMP_DIR/package.json"
|
||||
if [[ -f "$WEBUI/package-lock.release.json" ]]; then
|
||||
cp "$WEBUI/package-lock.release.json" "$TMP_DIR/package-lock.json"
|
||||
fi
|
||||
|
||||
echo "Generating release lockfile from $WEBUI/package.release.json"
|
||||
echo "Temporary workspace: $TMP_DIR"
|
||||
@@ -120,7 +117,10 @@ GIT_ENV+=("GIT_CONFIG_COUNT=$git_config_count")
|
||||
|
||||
(
|
||||
cd "$TMP_DIR"
|
||||
"${GIT_ENV[@]}" PATH="$(dirname "$NPM_BIN"):$PATH" "$NPM_BIN" install --package-lock-only --ignore-scripts
|
||||
"${GIT_ENV[@]}" \
|
||||
"npm_config_cache=$TMP_DIR/npm-cache" \
|
||||
PATH="$(dirname "$NPM_BIN"):$PATH" \
|
||||
"$NPM_BIN" install --package-lock-only --ignore-scripts
|
||||
mapfile -t GIT_PACKAGES < <(
|
||||
PATH="$(dirname "$NODE_BIN"):$PATH" "$NODE_BIN" <<'NODE'
|
||||
const fs = require("fs");
|
||||
@@ -136,7 +136,10 @@ NODE
|
||||
)
|
||||
if [[ "${#GIT_PACKAGES[@]}" -gt 0 ]]; then
|
||||
echo "Refreshing git package lock entries: ${GIT_PACKAGES[*]}"
|
||||
"${GIT_ENV[@]}" PATH="$(dirname "$NPM_BIN"):$PATH" "$NPM_BIN" update --package-lock-only --ignore-scripts "${GIT_PACKAGES[@]}"
|
||||
"${GIT_ENV[@]}" \
|
||||
"npm_config_cache=$TMP_DIR/npm-cache" \
|
||||
PATH="$(dirname "$NPM_BIN"):$PATH" \
|
||||
"$NPM_BIN" update --package-lock-only --ignore-scripts "${GIT_PACKAGES[@]}"
|
||||
fi
|
||||
)
|
||||
|
||||
|
||||
@@ -413,6 +413,11 @@ if project_name != "govoplan-core":
|
||||
peers["@govoplan/core-webui"] = f"^{new_version}"
|
||||
path.write_text(json.dumps(data, indent=2) + "\n")
|
||||
PYCODE
|
||||
done
|
||||
|
||||
"$PYTHON" "$META_ROOT/tools/release/synchronize-webui-package-metadata.py" --repo "$repo"
|
||||
for package_path in "$repo/package.json" "$repo/webui/package.json"; do
|
||||
[[ -f "$package_path" ]] || continue
|
||||
synchronize_lockfile_root "$package_path" "${package_path%package.json}package-lock.json"
|
||||
done
|
||||
|
||||
@@ -461,7 +466,19 @@ if not isinstance(version, str) or not version:
|
||||
lock["version"] = version
|
||||
packages = lock.get("packages")
|
||||
if isinstance(packages, dict) and isinstance(packages.get(""), dict):
|
||||
packages[""]["version"] = version
|
||||
root = packages[""]
|
||||
root["version"] = version
|
||||
for group in (
|
||||
"dependencies",
|
||||
"devDependencies",
|
||||
"optionalDependencies",
|
||||
"peerDependencies",
|
||||
"peerDependenciesMeta",
|
||||
):
|
||||
if group in package:
|
||||
root[group] = package[group]
|
||||
else:
|
||||
root.pop(group, None)
|
||||
lock_path.write_text(json.dumps(lock, indent=2) + "\n")
|
||||
PYCODE
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Synchronize duplicated publish and development WebUI package contracts."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SYNCHRONIZED_KEYS = ("peerDependencies", "peerDependenciesMeta")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--repo", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
root_path = args.repo / "package.json"
|
||||
webui_path = args.repo / "webui" / "package.json"
|
||||
if not root_path.exists() or not webui_path.exists():
|
||||
return 0
|
||||
|
||||
root = _load(root_path)
|
||||
webui = _load(webui_path)
|
||||
root_name = root.get("name")
|
||||
webui_name = webui.get("name")
|
||||
if not isinstance(root_name, str) or root_name != webui_name:
|
||||
return 0
|
||||
|
||||
changed = False
|
||||
for key in SYNCHRONIZED_KEYS:
|
||||
if key in webui:
|
||||
value = webui[key]
|
||||
if root.get(key) != value:
|
||||
root[key] = value
|
||||
changed = True
|
||||
elif key in root:
|
||||
del root[key]
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
root_path.write_text(json.dumps(root, indent=2) + "\n")
|
||||
print(f"Synchronized WebUI peer metadata in {root_path}")
|
||||
return 0
|
||||
|
||||
|
||||
def _load(path: Path) -> dict[str, object]:
|
||||
payload = json.loads(path.read_text())
|
||||
if not isinstance(payload, dict):
|
||||
raise SystemExit(f"package metadata must be an object: {path}")
|
||||
return payload
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user