From 8d686b855bd5cd8cada300db5056cf21f6eaf8e4 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Fri, 6 Dec 2024 13:39:52 +0100 Subject: [PATCH] [eas-cli] make version/CFBundleShortVersionString validation logic show warn instead of throwing an error (#2741) * [eas-cli] make version/CFBundleShortVersionString validation logic show warn instead of throwing an error * fix tests * add changelog entry --- CHANGELOG.md | 2 ++ .../src/build/ios/__tests__/version-test.ts | 22 ------------------- packages/eas-cli/src/build/ios/version.ts | 8 +++---- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8119d792f2..89e7da4750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This is the log of notable changes to EAS CLI and related packages. ### 🧹 Chores +- Print warning instead of throwing an error when validating `CFBundleShortVersionString` against App Store requirements. ([#2741](https://github.com/expo/eas-cli/pull/2741) by [@szdziedzic](https://github.com/szdziedzic)) + ## [14.0.1](https://github.com/expo/eas-cli/releases/tag/v14.0.1) - 2024-12-06 ### 🧹 Chores diff --git a/packages/eas-cli/src/build/ios/__tests__/version-test.ts b/packages/eas-cli/src/build/ios/__tests__/version-test.ts index edf88bf566..beaffc1858 100644 --- a/packages/eas-cli/src/build/ios/__tests__/version-test.ts +++ b/packages/eas-cli/src/build/ios/__tests__/version-test.ts @@ -5,7 +5,6 @@ import { vol } from 'memfs'; import os from 'os'; import type { XCBuildConfiguration } from 'xcode'; -import { learnMore } from '../../../log'; import { readPlistAsync } from '../../../utils/plist'; import { resolveVcsClient } from '../../../vcs'; import { @@ -301,27 +300,6 @@ describe(readShortVersionAsync, () => { ); expect(buildNumber).toBe('1.0.0'); }); - - it('fails when build number is invalid', async () => { - const exp = initBareWorkflowProject({ - appVersion: '$(CURRENT_PROJECT_VERSION)', - }); - - await expect( - readShortVersionAsync( - '/app', - exp, - { - CURRENT_PROJECT_VERSION: '0.0.7.1.028', - }, - vcsClient - ) - ).rejects.toThrowError( - `The required format for "CFBundleShortVersionString" in Info.plist is one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. Current value: 0.0.7.1.028. Edit the "CFBundleShortVersionString" in your Info.plist to match the required format. ${learnMore( - 'https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring' - )}` - ); - }); }); describe('managed project', () => { diff --git a/packages/eas-cli/src/build/ios/version.ts b/packages/eas-cli/src/build/ios/version.ts index c0b2c193ad..69a8be03f8 100644 --- a/packages/eas-cli/src/build/ios/version.ts +++ b/packages/eas-cli/src/build/ios/version.ts @@ -109,14 +109,14 @@ function validateShortVersion({ }): void { if (shortVersion && !SHORT_VERSION_REGEX.test(shortVersion)) { if (workflow === Workflow.MANAGED) { - throw new Error( - `The required format for "version" field from app.json/app.config.ts is one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. Current value: ${shortVersion}. Edit the "version" field in your app.json/app.config.ts to match the required format. ${learnMore( + Log.warn( + `The required format for "version" field from app.json/app.config.ts for App Store iOS builds is one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. Current value: ${shortVersion}. Edit the "version" field in your app.json/app.config.ts to match the format required by Apple. ${learnMore( 'https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring' )}` ); } else { - throw new Error( - `The required format for "CFBundleShortVersionString" in Info.plist is one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. Current value: ${shortVersion}. Edit the "CFBundleShortVersionString" in your Info.plist to match the required format. ${learnMore( + Log.warn( + `The required format for "CFBundleShortVersionString" in Info.plist for App Store iOS builds is one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. Current value: ${shortVersion}. Edit the "CFBundleShortVersionString" in your Info.plist to match the format required by Apple. ${learnMore( 'https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring' )}` );