update 33.1 50

This commit is contained in:
2026-08-10 03:23:30 -03:00
parent 33f0559268
commit ef63b02554
23 changed files with 753 additions and 368 deletions

View File

@@ -11,6 +11,7 @@ Usage:
python ctrl/spr.py sync soleprint-ui ~/wdir/unt/ui/framework
python ctrl/spr.py watch soleprint-ui ~/wdir/unt/ui/framework # ctrl+c to stop
python ctrl/spr.py publish soleprint-ui ~/wdir/mpr/ui/framework
python ctrl/spr.py publish soleprint-ui /tmp/out --dist # built bundle only
python ctrl/spr.py diff soleprint-ui ~/wdir/mpr/ui/framework
"""
@@ -194,6 +195,37 @@ def cmd_list(args):
log.info(" %s %s v%-10s %s", f"{name:<25}", f"{comp_type:<5}", version, entry["path"])
def publish_dist(source, dest):
"""Copy only the built bundle — dist/ plus the manifest and any docs.
The artifact-only form: a consumer gets something that runs, not the
sources. Deliberately NOT a variant of copy_tree, which walks the whole
tree and strips dist; here dist is the entire point.
"""
dist = source / "dist"
if not dist.is_dir() or not any(dist.iterdir()):
log.error("no build at %s", dist)
log.info("build it first: cd %s && pnpm build", source)
sys.exit(1)
count = 0
dest.mkdir(parents=True, exist_ok=True)
for item in dist.rglob("*"):
if item.is_file():
target = dest / "dist" / item.relative_to(dist)
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(item, target)
count += 1
# The manifest travels too, or the bundle's entry points aren't resolvable.
for name in ("package.json", "README.md", "LICENSE"):
if (source / name).is_file():
shutil.copy2(source / name, dest / name)
count += 1
return count
def cmd_publish(args):
registry = load_registry()
comp_type, source = resolve_component(registry, args.component)
@@ -202,12 +234,17 @@ def cmd_publish(args):
if dest.exists():
shutil.rmtree(dest)
count = copy_tree(source, dest)
write_stamp(dest, args.component, comp_type, source, "published")
if args.dist:
count = publish_dist(source, dest)
mode = "published-dist"
else:
count = copy_tree(source, dest)
mode = "published"
write_stamp(dest, args.component, comp_type, source, mode)
version = get_version(comp_type, source)
sha = get_sha()
log.info("%s v%s (%s) -> %s (%d files)", args.component, version, sha, dest, count)
log.info("%s v%s (%s) -> %s (%d files, %s)", args.component, version, sha, dest, count, mode)
def cmd_sync(args):
@@ -306,6 +343,12 @@ def main():
p = sub.add_parser(cmd)
p.add_argument("component", help="component name")
p.add_argument("dest", help="target folder path")
if cmd == "publish":
p.add_argument(
"--dist",
action="store_true",
help="ship only the built bundle (dist/ + manifest), not the sources",
)
p = sub.add_parser("watch", help="continuous two-way sync (foreground, ctrl+c to stop)")
p.add_argument("component", help="component name")