Serialize the manifest to JSON on disk. The format matches what the WASM bootstrap expects for injection as ``window.fastledAssetManifest``. ``None`` fields are preserved so future JS consumers can detect absent metadata without extra contains-checks. Args: scan: Result of
(scan: AssetScanResult, out_path: Path)
| 190 | |
| 191 | |
| 192 | def write_manifest_json(scan: AssetScanResult, out_path: Path) -> None: |
| 193 | """Serialize the manifest to JSON on disk. |
| 194 | |
| 195 | The format matches what the WASM bootstrap expects for injection as |
| 196 | ``window.fastledAssetManifest``. ``None`` fields are preserved so future |
| 197 | JS consumers can detect absent metadata without extra contains-checks. |
| 198 | |
| 199 | Args: |
| 200 | scan: Result of :func:`scan_sketch_assets`. |
| 201 | out_path: Destination ``.json`` file. Parent directories are created |
| 202 | on demand. |
| 203 | """ |
| 204 | out_path.parent.mkdir(parents=True, exist_ok=True) |
| 205 | with out_path.open("w", encoding="utf-8") as f: |
| 206 | json.dump(scan.to_json_dict(), f, indent=2, sort_keys=True) |
| 207 | f.write("\n") |
| 208 | |
| 209 | |
| 210 | def manifest_to_js_bootstrap(scan: AssetScanResult) -> str: |