From bcd21bdfec550b8915e3aad2c290a9b17d12452e Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 13 Dec 2025 14:06:46 +0900 Subject: [PATCH] fix build option pkg version --- ios/build.zsh | 16 ++++++++++++++++ ios/preview.zsh | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/ios/build.zsh b/ios/build.zsh index 5d65cd2..dfc2e79 100755 --- a/ios/build.zsh +++ b/ios/build.zsh @@ -41,6 +41,22 @@ else fi function cleanup_build { + # 1.8. Update package.json version (prevent App Store version conflict) + echo "1.8. Updating package.json version..." + if [ -n "$APP_VERSION" ]; then + PACKAGE_JSON="$REPO_DIR/package.json" + # Use node to update version in package.json + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('$PACKAGE_JSON', 'utf8')); + pkg.version = '$APP_VERSION'; + fs.writeFileSync('$PACKAGE_JSON', JSON.stringify(pkg, null, 2) + '\n'); + " + echo " ✅ Set version to $APP_VERSION" + else + echo " ⚠️ APP_VERSION not set in .env" + fi + # 2. Prebuild (Generate ios directory) echo "2. Running Expo Prebuild..." # Clean old ios folder to remove old entitlements/AppClip targets diff --git a/ios/preview.zsh b/ios/preview.zsh index 9c0c88b..f89d316 100755 --- a/ios/preview.zsh +++ b/ios/preview.zsh @@ -34,6 +34,21 @@ else echo "⚠️ Warning: $ASSETS_DIR not found" fi +# 1.8. Update package.json version (prevent App Store version conflict) +echo "1.8. Updating package.json version..." +if [ -n "$APP_VERSION" ]; then + PACKAGE_JSON="$REPO_DIR/package.json" + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('$PACKAGE_JSON', 'utf8')); + pkg.version = '$APP_VERSION'; + fs.writeFileSync('$PACKAGE_JSON', JSON.stringify(pkg, null, 2) + '\n'); + " + echo " ✅ Set version to $APP_VERSION" +else + echo " ⚠️ APP_VERSION not set in .env" +fi + # 2. Prebuild (Generate ios directory) echo "2. Running Expo Prebuild..." # Clean old ios folder to remove old entitlements/AppClip targets