mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Auto update viewer version (#1825)
This commit is contained in:
1 parent
3f43e0d4c3
commit
b753a0063c
1 file changed
+19
-7
@@ -1,6 +1,7 @@
|
|||||||
"""Generate viser message definitions for TypeScript, by parsing Python dataclasses."""
|
"""Generate viser message definitions for TypeScript, by parsing Python dataclasses."""
|
||||||
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
from datetime import datetime
|
||||||
|
|
||||||
import tyro
|
import tyro
|
||||||
from viser.infra import generate_typescript_interfaces
|
from viser.infra import generate_typescript_interfaces
|
||||||
@@ -23,13 +24,24 @@ def main() -> None:
|
|||||||
"nerfstudio/viewer/app/src/modules/WebSocket/ViserMessages.tsx"
|
"nerfstudio/viewer/app/src/modules/WebSocket/ViserMessages.tsx"
|
||||||
)
|
)
|
||||||
assert target_path.exists()
|
assert target_path.exists()
|
||||||
target_path.write_text(defs, encoding="utf_8")
|
|
||||||
print(f"Wrote to {target_path}")
|
|
||||||
|
|
||||||
# Run prettier.
|
old_defs = target_path.read_text(encoding="utf_8")
|
||||||
# TODO: if this is not installed maybe we should print some error with installation
|
|
||||||
# instructions?
|
if old_defs != defs:
|
||||||
subprocess.run(args=["prettier", "-w", str(target_path)], check=False)
|
target_path.write_text(defs, encoding="utf_8")
|
||||||
|
|
||||||
|
with open("nerfstudio/viewer/app/package.json", "r", encoding="utf_8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
now = datetime.now()
|
||||||
|
data["version"] = now.strftime("%y-%m-%d") + "-0"
|
||||||
|
|
||||||
|
with open("nerfstudio/viewer/app/package.json", "w", encoding="utf_8") as f:
|
||||||
|
json.dump(data, f, indent=2)
|
||||||
|
print(f"Wrote updates to {target_path}")
|
||||||
|
print(f"Current viewer version is now {data['version']}")
|
||||||
|
else:
|
||||||
|
print("No update to messages.")
|
||||||
|
|
||||||
|
|
||||||
def entrypoint() -> None:
|
def entrypoint() -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user