Spaces:
Sleeping
Sleeping
File size: 869 Bytes
58e6885 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #!/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()
|