diff --git a/scripts/figma-sync.py b/scripts/figma-sync.py index c25709e..b16a634 100755 --- a/scripts/figma-sync.py +++ b/scripts/figma-sync.py @@ -106,7 +106,7 @@ async def main(): # --- Extraction --- try: source = FigmaTokenSource(figma_token=token, verbose=args.verbose) - token_collection, component_registry = await source.extract(file_key) + token_collection, components = await source.extract(file_key) except Exception as e: print(f"\n[ERROR] An error occurred during extraction: {e}", file=sys.stderr) # In verbose mode, print more details @@ -120,13 +120,27 @@ async def main(): print("\n[3/3] Writing output...") writer = OutputWriter(verbose=args.verbose) writer.write_token_collection(token_collection) + + # Build component registry dict from List[Component] + component_registry = { + "file_key": file_key, + "component_count": len(components), + "components": [ + { + "name": c.name, + "atomic_type": c.atomic_type.value if hasattr(c.atomic_type, 'value') else str(c.atomic_type), + "variant_count": len(c.variants) if c.variants else 0, + } + for c in components + ] + } writer.write_components(component_registry) # --- Summary --- print_summary( - file_name=component_registry.get("file_name", "Unknown"), + file_name=file_key, token_count=len(token_collection), - component_count=component_registry.get("component_count", 0), + component_count=len(components), ) print("\n[OK] Sync successful!")