Colota - Android GPS Location tracker
updated screenshots
Max Dietrich83f1ecd72aea
diff --git a/scripts/bump-version.py b/scripts/bump-version.pynew file mode 100644index 00000000..8ddec50f--- /dev/null+++ b/scripts/bump-version.py@@ -0,0 +1,121 @@+#!/usr/bin/env python3+"""+bump-version.py - Update the version across the entire Colota monorepo.++Usage:+ python scripts/bump-version.py <version>++Example:+ python scripts/bump-version.py 1.1.0++The script updates:+ - package.json (root)+ - apps/mobile/package.json+ - apps/docs/package.json+ - packages/shared/package.json+ - apps/mobile/android/app/build.gradle (versionName + auto-incremented versionCode)++It does NOT create any git commits or tags.+"""++import json+import re+import sys+from pathlib import Path++REPO_ROOT = Path(__file__).resolve().parent.parent++PACKAGE_FILES = [+ REPO_ROOT / "package.json",+ REPO_ROOT / "apps" / "mobile" / "package.json",+ REPO_ROOT / "apps" / "docs" / "package.json",+ REPO_ROOT / "packages" / "shared" / "package.json",+]++BUILD_GRADLE = REPO_ROOT / "apps" / "mobile" / "android" / "app" / "build.gradle"+++def update_package_json(file: Path, version: str):+ if not file.is_file():+ print(f" Warning: {file} not found - skipping.")+ return++ text = file.read_text(encoding="utf-8")+ pkg = json.loads(text)+ old_version = pkg.get("version", "(none)")++ pkg["version"] = version++ # Detect indent from original file+ indent_match = re.search(r"^([ \t]+)", text, re.MULTILINE)+ indent = indent_match.group(1) if indent_match else " "+ indent_size = len(indent)++ file.write_text(json.dumps(pkg, indent=indent_size, ensure_ascii=False) + "\n", encoding="utf-8")++ display = file.relative_to(REPO_ROOT)+ print(f" {display}: {old_version} -> {version}")+++def update_build_gradle(file: Path, version: str):+ if not file.is_file():+ print(f" Warning: {file} not found - skipping.")+ return++ text = file.read_text(encoding="utf-8")++ # Read current values+ name_match = re.search(r'versionName "(.+?)"', text)+ code_match = re.search(r"versionCode (\d+)", text)++ old_name = name_match.group(1) if name_match else "(unknown)"+ old_code = int(code_match.group(1)) if code_match else 0+ new_code = old_code + 1++ # Update+ text = re.sub(r'versionName ".+?"', f'versionName "{version}"', text)+ text = re.sub(r"versionCode \d+", f"versionCode {new_code}", text)++ file.write_text(text, encoding="utf-8")++ display = file.relative_to(REPO_ROOT)+ print(f" {display}:")+ print(f' versionName: "{old_name}" -> "{version}"')+ print(f" versionCode: {old_code} -> {new_code}")+++def main():+ if len(sys.argv) != 2:+ print("Usage: python scripts/bump-version.py <version>")+ print(" version must be in semver format: x.y.z (e.g. 1.2.3)")+ sys.exit(1)++ version = sys.argv[1]++ if not re.match(r"^\d+\.\d+\.\d+$", version):+ print(f"Error: Invalid version format '{version}'.")+ print(" Expected semver format: x.y.z (e.g. 1.2.3)")+ sys.exit(1)++ print()+ print(f"Bumping version to {version}")+ print("================================")+ print()++ print("Updating package.json files:")+ for file in PACKAGE_FILES:+ update_package_json(file, version)+ print()++ print("Updating build.gradle:")+ update_build_gradle(BUILD_GRADLE, version)+ print()++ print("================================")+ print(f"Done. Version bumped to {version}.")+ print("No git commits or tags were created.")+ print()+++if __name__ == "__main__":+ main()diff --git a/scripts/bump-version.sh b/scripts/bump-version.shdeleted file mode 100644index e9cdaf68..00000000--- a/scripts/bump-version.sh+++ /dev/null@@ -1,164 +0,0 @@-#!/usr/bin/env bash-#-# bump-version.sh — Update the version across the entire Colota monorepo.-#-# Usage:-# ./scripts/bump-version.sh <version>-#-# Example:-# ./scripts/bump-version.sh 1.1.0-#-# The script updates:-# - package.json (root)-# - apps/mobile/package.json-# - apps/docs/package.json-# - packages/shared/package.json-# - apps/mobile/android/app/build.gradle (versionName + auto-incremented versionCode)-#-# It does NOT create any git commits or tags.--set -euo pipefail--# ----------------------------------------------------------------------------# Resolve the repository root (parent of the scripts/ directory)-# ----------------------------------------------------------------------------SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"--# ----------------------------------------------------------------------------# Validate arguments-# ----------------------------------------------------------------------------if [[ $# -ne 1 ]]; then- echo "Usage: $0 <version>"- echo " version must be in semver format: x.y.z (e.g. 1.2.3)"- exit 1-fi--NEW_VERSION="$1"--# Validate semver format (major.minor.patch, all non-negative integers)-if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then- echo "Error: Invalid version format '$NEW_VERSION'."- echo " Expected semver format: x.y.z (e.g. 1.2.3)"- exit 1-fi--# ----------------------------------------------------------------------------# Paths-# ----------------------------------------------------------------------------ROOT_PKG="$REPO_ROOT/package.json"-MOBILE_PKG="$REPO_ROOT/apps/mobile/package.json"-DOCS_PKG="$REPO_ROOT/apps/docs/package.json"-SHARED_PKG="$REPO_ROOT/packages/shared/package.json"-BUILD_GRADLE="$REPO_ROOT/apps/mobile/android/app/build.gradle"--# ----------------------------------------------------------------------------# Helper: convert a path to a form that Node.js can use on any OS.-# On Windows (MSYS2/Git Bash) paths like /c/Users/... must become C:/Users/...-# ----------------------------------------------------------------------------to_node_path() {- local p="$1"- # Detect MSYS/Git-Bash style /c/ prefix and convert to C:/- if [[ "$p" =~ ^/([a-zA-Z])/ ]]; then- p="${BASH_REMATCH[1]^}:/${p:3}"- fi- echo "$p"-}--# ----------------------------------------------------------------------------# Helper: update "version" in a package.json using node (handles JSON safely)-# ----------------------------------------------------------------------------update_package_json() {- local file="$1"- local version="$2"-- if [[ ! -f "$file" ]]; then- echo " Warning: $file not found — skipping."- return- fi-- local node_file- node_file=$(to_node_path "$file")-- # Read old version (may be absent)- local old_version- old_version=$(node -e "- const fs = require('fs');- const pkg = JSON.parse(fs.readFileSync('$node_file', 'utf8'));- console.log(pkg.version || '(none)');- " 2>/dev/null) || old_version="(unknown)"-- # Write new version — use a small Node script to preserve formatting- node -e "- const fs = require('fs');- const raw = fs.readFileSync('$node_file', 'utf8');- const pkg = JSON.parse(raw);- pkg.version = '$version';- // Detect indent (default 2 spaces)- const indent = (raw.match(/^[ \t]+/m) || [' '])[0];- fs.writeFileSync('$node_file', JSON.stringify(pkg, null, indent) + '\n');- "-- # Display a relative-ish path for readability- local display_path="${file#$REPO_ROOT/}"- echo " $display_path: $old_version -> $version"-}--# ----------------------------------------------------------------------------# Helper: update versionName and versionCode in build.gradle-# ----------------------------------------------------------------------------update_build_gradle() {- local file="$1"- local version="$2"-- if [[ ! -f "$file" ]]; then- echo " Warning: $file not found — skipping."- return- fi-- # Read current versionName- local old_version_name- old_version_name=$(sed -n 's/.*versionName "\(.*\)"/\1/p' "$file" | head -1)-- # Read current versionCode- local old_version_code- old_version_code=$(sed -n 's/.*versionCode \([0-9]*\)/\1/p' "$file" | head -1)-- # Compute new versionCode- local new_version_code=$(( old_version_code + 1 ))-- # Update versionName- sed -i "s/versionName \"$old_version_name\"/versionName \"$version\"/" "$file"-- # Update versionCode- sed -i "s/versionCode $old_version_code/versionCode $new_version_code/" "$file"-- local display_path="${file#$REPO_ROOT/}"- echo " $display_path:"- echo " versionName: \"$old_version_name\" -> \"$version\""- echo " versionCode: $old_version_code -> $new_version_code"-}--# ----------------------------------------------------------------------------# Main-# ----------------------------------------------------------------------------echo ""-echo "Bumping version to $NEW_VERSION"-echo "================================"-echo ""--echo "Updating package.json files:"-update_package_json "$ROOT_PKG" "$NEW_VERSION"-update_package_json "$MOBILE_PKG" "$NEW_VERSION"-update_package_json "$DOCS_PKG" "$NEW_VERSION"-update_package_json "$SHARED_PKG" "$NEW_VERSION"-echo ""--echo "Updating build.gradle:"-update_build_gradle "$BUILD_GRADLE" "$NEW_VERSION"-echo ""--echo "================================"-echo "Done. Version bumped to $NEW_VERSION."-echo "No git commits or tags were created."-echo ""diff --git a/scripts/sync-screenshots.py b/scripts/sync-screenshots.pynew file mode 100644index 00000000..947cfc68--- /dev/null+++ b/scripts/sync-screenshots.py@@ -0,0 +1,75 @@+#!/usr/bin/env python3+"""+sync-screenshots.py - Sync screenshots from the single source of truth+to the docs site and Fastlane (F-Droid + Play Store) metadata.++Usage:+ python scripts/sync-screenshots.py++Source: screenshots/mobile/original/+Targets:+ - apps/docs/static/img/screenshots/ (named, for docs site)+ - apps/mobile/android/app/fastlane/metadata/ (numbered, for stores)+"""++import shutil+import sys+from pathlib import Path++REPO_ROOT = Path(__file__).resolve().parent.parent++SRC = REPO_ROOT / "screenshots" / "mobile" / "original"+DOCS = REPO_ROOT / "apps" / "docs" / "static" / "img" / "screenshots"+STORE = REPO_ROOT / "apps" / "mobile" / "android" / "app" / "fastlane" / "metadata" / "android" / "en-US" / "images" / "phoneScreenshots"++STORE_ORDER = [+ "Dashboard.png",+ "Settings.png",+ "Authentication.png",+ "TrackingProfiles.png",+ "DataManagement.png",+ "ApiFieldMapping.png",+ "ExportData.png",+ "DarkMode.png",+]++def main():+ if not SRC.is_dir():+ print(f"Error: Source directory not found: {SRC}")+ sys.exit(1)++ print()+ print("Syncing screenshots")+ print("================================")+ print()++ # Sync to docs (named copies)+ DOCS.mkdir(parents=True, exist_ok=True)++ print("Docs (named):")+ for file in sorted(SRC.glob("*.png")):+ shutil.copy2(file, DOCS / file.name)+ print(f" {file.name} -> docs")++ # Sync to Fastlane store metadata (numbered copies)+ print()+ STORE.mkdir(parents=True, exist_ok=True)++ print("Fastlane (numbered):")+ count = 0+ for i, name in enumerate(STORE_ORDER, start=1):+ src_file = SRC / name+ if not src_file.is_file():+ print(f" Warning: {name} not found in source - skipping.")+ continue+ shutil.copy2(src_file, STORE / f"{i}.png")+ print(f" {name} -> {i}.png")+ count += 1++ print()+ print("================================")+ print(f"Done. {count} screenshots synced.")+ print()++if __name__ == "__main__":+ main()diff --git a/scripts/sync-screenshots.sh b/scripts/sync-screenshots.shdeleted file mode 100644index dfbed26a..00000000--- a/scripts/sync-screenshots.sh+++ /dev/null@@ -1,88 +0,0 @@-#!/usr/bin/env bash-#-# sync-screenshots.sh — Sync screenshots from the single source of truth-# to the docs site and Fastlane (F-Droid + Play Store) metadata.-#-# Usage:-# ./scripts/sync-screenshots.sh-#-# Source: screenshots/mobile/original/-# Targets:-# - apps/docs/static/img/screenshots/ (named, for docs site)-# - apps/mobile/android/app/fastlane/metadata/ (numbered, for stores)--set -euo pipefail--# ----------------------------------------------------------------------------# Resolve the repository root (parent of the scripts/ directory)-# ----------------------------------------------------------------------------SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"-REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"--# ----------------------------------------------------------------------------# Paths-# ----------------------------------------------------------------------------SRC="$REPO_ROOT/screenshots/mobile/original"-DOCS="$REPO_ROOT/apps/docs/static/img/screenshots"-STORE="$REPO_ROOT/apps/mobile/android/app/fastlane/metadata/android/en-US/images/phoneScreenshots"--# Ordered mapping: source filename → store number-STORE_ORDER=(- "Dashboard.png"- "Settings.png"- "Authentication.png"- "TrackingProfiles.png"- "DataManagement.png"- "ApiFieldMapping.png"- "ExportData.png"- "DarkMode.png"-)--# ----------------------------------------------------------------------------# Validate source directory-# ----------------------------------------------------------------------------if [[ ! -d "$SRC" ]]; then- echo "Error: Source directory not found: $SRC"- exit 1-fi--# ----------------------------------------------------------------------------# Sync to docs (named copies)-# ----------------------------------------------------------------------------echo ""-echo "Syncing screenshots"-echo "================================"-echo ""--mkdir -p "$DOCS"--echo "Docs (named):"-for file in "$SRC"/*.png; do- name="$(basename "$file")"- cp "$file" "$DOCS/$name"- echo " $name -> docs"-done--# ----------------------------------------------------------------------------# Sync to Fastlane store metadata (numbered copies)-# ----------------------------------------------------------------------------echo ""-mkdir -p "$STORE"--echo "Fastlane (numbered):"-i=1-for name in "${STORE_ORDER[@]}"; do- src_file="$SRC/$name"- if [[ ! -f "$src_file" ]]; then- echo " Warning: $name not found in source — skipping."- continue- fi- cp "$src_file" "$STORE/$i.png"- echo " $name -> $i.png"- i=$((i + 1))-done--echo ""-echo "================================"-echo "Done. $(( i - 1 )) screenshots synced."-echo ""