From 41595159d99842538fa193cd5892c6b234bca297 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 30 Jul 2026 22:38:13 +0700 Subject: [PATCH] Auto-sync Android version from package.json (no more manual gradle bumps) Adds scripts/sync-android-version.mjs which writes versionName (semver) and a monotonic versionCode (major*10000+minor*100+patch) into android/app/build.gradle from package.json. Wired into `npm run android:build` and `android:sync`, plus a standalone `npm run android:version`. Now you bump ONE number (package.json) and never hit Zapstore's "already exists" again. Exits quietly if android/ isn't generated yet. Co-authored-by: shakespeare.diy --- package.json | 5 +-- scripts/sync-android-version.mjs | 53 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 scripts/sync-android-version.mjs diff --git a/package.json b/package.json index a7d34fb..58556db 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,10 @@ "test": "npm i --silent && tsc --noEmit && eslint && vitest run --reporter=dot --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'All tests passed!'", "deploy": "npm i --silent && npm run build && npx -y nostr-deploy-cli deploy --skip-setup", "android:init": "npm run android:build:apk && npx cap add android && npx cap sync android", - "android:sync": "npm run android:build:apk && npx cap sync android", + "android:sync": "npm run android:build:apk && npx cap sync android && node scripts/sync-android-version.mjs", "android:open": "npx cap open android", - "android:build": "npm run android:build:apk && npx cap sync android && cd android && ./gradlew assembleRelease", + "android:version": "node scripts/sync-android-version.mjs", + "android:build": "npm run android:build:apk && npx cap sync android && node scripts/sync-android-version.mjs && cd android && ./gradlew assembleRelease", "android:build:apk": "CAPACITOR_BUILD=1 vite build && sed -i 's|||g' dist/index.html && sed -i 's|