Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| LIB_DIR = ROOT / "modules/chart_engine/static/lib" | |
| SOURCE_DIR = LIB_DIR / "chart_utils" | |
| BUNDLE_PATH = LIB_DIR / "utils.js" | |
| CHART_UTILS_FILES = [ | |
| "core.js", | |
| "schema.js", | |
| "format.js", | |
| "color.js", | |
| "text.js", | |
| "legend.js", | |
| "index.js", | |
| "compat.js", | |
| ] | |
| def main() -> None: | |
| missing = [name for name in CHART_UTILS_FILES if not (SOURCE_DIR / name).is_file()] | |
| if missing: | |
| raise SystemExit(f"Missing chart_utils source files: {', '.join(missing)}") | |
| bundle = "\n\n".join( | |
| (SOURCE_DIR / name).read_text(encoding="utf-8").rstrip() | |
| for name in CHART_UTILS_FILES | |
| ) | |
| BUNDLE_PATH.write_text(bundle + "\n", encoding="utf-8") | |
| print(f"Wrote {BUNDLE_PATH.relative_to(ROOT)}") | |
| if __name__ == "__main__": | |
| main() | |