Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

release svelte

Preetham Pemmasanie3aba90f9443
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 86b0ea5..0523102 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -126,10 +126,10 @@ jobs:
- name: Install workspace dependencies
working-directory: bindings
run: npm ci
- - name: Publish @blender-ui/native then @blender-ui/react, with no token (OIDC)
+ - name: Publish the npm packages, native first, with no token (OIDC)
run: |
- # native first: react depends on it
- for pkg in node react; do
+ # the workspaces of bindings/package.json, in order: native first, the frameworks depend on it
+ for pkg in $(node -p "require('./bindings/package.json').workspaces.join(' ')"); do
cd "bindings/$pkg"
name=$(node -p "require('./package.json').name")
version=$(node -p "require('./package.json').version")
diff --git a/tools/bump_version.py b/tools/bump_version.py
index a2c079e..1af60c1 100644
--- a/tools/bump_version.py
+++ b/tools/bump_version.py
@@ -18,8 +18,8 @@ Where the version lives (one source of truth per registry, all moved together):
* Python: `bindings/python/bui/_version.py` (the wheel reads it).
* Rust: `[workspace.package]` in `bindings/rust/Cargo.toml`, and the `version = "..."` of every
sibling path dependency (`blenderui-sys = { path = "...", version = "..." }`).
-* npm (only with `--npm`): `bindings/node` and `bindings/react` move together, and react's
- dependency on native. npm versions are otherwise independent of the tag.
+* npm (only with `--npm`): every package in `bindings/package.json`'s workspaces moves to the
+ same version, and their dependency on `@blender-ui/native` with it. npm versions are otherwise independent of the tag.
* `CHANGELOG.md`: `[Unreleased]` becomes a dated section and a fresh `[Unreleased]` opens.
* The lock files (`Cargo.lock`, `bindings/package-lock.json`) are refreshed (best effort).
@@ -34,6 +34,8 @@ import subprocess
import sys
from pathlib import Path
+from check_versions import npm_packages
+
ROOT = Path(__file__).resolve().parent.parent
RUST = ROOT / "bindings" / "rust"
PY_VERSION = ROOT / "bindings" / "python" / "bui" / "_version.py"
@@ -103,7 +105,7 @@ def plan_edits(new: str, npm: str | None) -> dict[Path, str]:
put(toml, "".join(out))
if npm:
- for pkg in ("node", "react"):
+ for pkg in npm_packages():
path = ROOT / "bindings" / pkg / "package.json"
text = read(path)
text = re.sub(r'("version"\s*:\s*")[^"]+(")', rf"\g<1>{npm}\g<2>", text, count=1)
diff --git a/tools/check_versions.py b/tools/check_versions.py
index c3b0c26..029fd8f 100644
--- a/tools/check_versions.py
+++ b/tools/check_versions.py
@@ -21,6 +21,11 @@ def read(path: Path) -> str:
return path.read_text(encoding="utf-8")
+def npm_packages() -> list[str]:
+ """The npm packages, in publish order: the workspaces of bindings/package.json (native first)."""
+ return json.loads(read(ROOT / "bindings" / "package.json"))["workspaces"]
+
+
def main() -> int:
if len(sys.argv) != 2:
print(__doc__)
@@ -42,7 +47,7 @@ def main() -> int:
bad = {k: v for k, v in found.items() if v != want}
for k, v in found.items():
print(f"{'ok ' if v == want else 'BAD'} {v:8} {k}")
- for pkg in ("node", "react"):
+ for pkg in npm_packages():
meta = json.loads(read(ROOT / "bindings" / pkg / "package.json"))
print(f"npm {meta['version']:8} {meta['name']} (own version; published only if new)")
if bad:
diff --git a/tools/release.py b/tools/release.py
index c427128..3224295 100644
--- a/tools/release.py
+++ b/tools/release.py
@@ -33,6 +33,8 @@ import urllib.error
import urllib.request
from pathlib import Path
+from check_versions import npm_packages
+
ROOT = Path(__file__).resolve().parent.parent
BUMP = ROOT / "tools" / "bump_version.py"
PY_VERSION = ROOT / "bindings" / "python" / "bui" / "_version.py"
@@ -131,7 +133,7 @@ def registry_status(version: str) -> dict[str, bool]:
out: dict[str, bool] = {}
for c in crates():
out[f"crates.io {c}"] = http_json(f"https://crates.io/api/v1/crates/{c}/{version}")[0] == 200
- for pkg in ("node", "react"):
+ for pkg in npm_packages():
meta = json.loads((ROOT / "bindings" / pkg / "package.json").read_text(encoding="utf-8"))
name = meta["name"].replace("/", "%2F")
out[f"npm {meta['name']}@{meta['version']}"] = (