def main()

in scripts/export-all.py [0:0]


def main():
    all_messages = []
    for format in FORMATS:
        path = Path("outgoing", f"{format}.json")
        with path.open() as f:
            messages = json.load(f)

            if messages is not None:
                all_messages.extend(messages)

    # Indent all but the first line by 4 spaces.
    json_lines = json.dumps(all_messages, indent=2).split("\n")
    messages_json = "\n".join(
        itertools.chain(
            [json_lines[0]],
            (f"    {line}" for line in json_lines[1:]),
        )
    )

    with Path("outgoing", "InflightAssetsMessageProvider.sys.mjs").open("wb") as f:
        f.write(JSM_CONTENTS.format(messages_json=messages_json).encode("utf-8"))