diff --git a/scripts/gen_checksums.sh b/scripts/gen_checksums.sh new file mode 100755 index 0000000..8135ee2 --- /dev/null +++ b/scripts/gen_checksums.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Generate SHA256 checksums for release assets +# Usage: ./scripts/gen_checksums.sh [directory] + +TARGET_DIR=${1:-"./dist"} + +if [ ! -d "$TARGET_DIR" ]; then + echo "Error: Directory $TARGET_DIR does not exist." + exit 1 +fi + +echo "Generating SHA256SUMS for assets in $TARGET_DIR..." +cd "$TARGET_DIR" || exit 1 + +# Exclude existing SHA256SUMS file if it exists +find . -maxdepth 1 -type f ! -name "SHA256SUMS" -exec sha256sum {} + > SHA256SUMS + +echo "Done. SHA256SUMS created in $TARGET_DIR" +cat SHA256SUMS + diff --git a/scripts/generate_locale_template.py b/scripts/generate_locale_template.py new file mode 100644 index 0000000..99e628f --- /dev/null +++ b/scripts/generate_locale_template.py @@ -0,0 +1,40 @@ +import json +import os +import sys + + +def clear_values(d): + """Recursively replace all string values with empty strings in a dictionary.""" + if isinstance(d, dict): + return {k: clear_values(v) for k, v in d.items()} + return "" + + +def main(): + # Paths are relative to the workspace root where Taskfile is run + en_path = os.path.join("meshchatx", "src", "frontend", "locales", "en.json") + out_path = "locales.json" + + if not os.path.exists(en_path): + print(f"Error: Source file not found at {en_path}") + sys.exit(1) + + try: + with open(en_path, "r", encoding="utf-8") as f: + en_data = json.load(f) + + template = clear_values(en_data) + + with open(out_path, "w", encoding="utf-8") as f: + json.dump(template, f, indent=4, ensure_ascii=False) + + print( + f"Successfully generated {out_path} with all keys from {en_path} (empty values)." + ) + except Exception as e: + print(f"Error generating locale template: {e}") + sys.exit(1) + + +if __name__ == "__main__": + main()