From b7bbfbd66877b48d79e6f214bfa9424d23b38439 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Sun, 30 Nov 2025 15:31:24 -0800 Subject: [PATCH 1/2] Allow exit from credentials command --- .../src/credentials/manager/SelectPlatform.ts | 2 +- packages/eas-cli/src/platform.ts | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/eas-cli/src/credentials/manager/SelectPlatform.ts b/packages/eas-cli/src/credentials/manager/SelectPlatform.ts index e4fe6759a8..8706545e30 100644 --- a/packages/eas-cli/src/credentials/manager/SelectPlatform.ts +++ b/packages/eas-cli/src/credentials/manager/SelectPlatform.ts @@ -20,7 +20,7 @@ export class SelectPlatform { ) {} async runAsync(): Promise { - const platform = await selectPlatformAsync(this.flagPlatform); + const platform = await selectPlatformAsync(this.flagPlatform, true /* allowExit */); if (platform === 'ios') { await new ManageIos(this, process.cwd()).runAsync(); diff --git a/packages/eas-cli/src/platform.ts b/packages/eas-cli/src/platform.ts index 3ee071f555..d5df2b3be6 100644 --- a/packages/eas-cli/src/platform.ts +++ b/packages/eas-cli/src/platform.ts @@ -1,6 +1,7 @@ import { Platform } from '@expo/eas-build-job'; import { AppPlatform } from './graphql/generated'; +import Log from './log'; import { promptAsync } from './prompts'; export const appPlatformDisplayNames: Record = { @@ -47,21 +48,39 @@ export async function selectRequestedPlatformAsync(platform?: string): Promise { +export async function selectPlatformAsync( + platform?: string, + allowExit?: boolean +): Promise { if (platform && Object.values(Platform).includes(platform.toLowerCase() as Platform)) { return platform.toLowerCase() as Platform; } - const { resolvedPlatform } = await promptAsync({ + const platformChoices: { title: string; value: Platform | 'Exit' }[] = [ + { title: 'Android', value: Platform.ANDROID }, + { title: 'iOS', value: Platform.IOS }, + ]; + + if (allowExit) { + platformChoices.push({ title: 'Exit', value: 'Exit' }); + } + + const result: any = await promptAsync({ type: 'select', message: 'Select platform', name: 'resolvedPlatform', choices: [ { title: 'Android', value: Platform.ANDROID }, { title: 'iOS', value: Platform.IOS }, + { title: 'Exit', value: 'Exit' }, ], }); - return resolvedPlatform; + if (result.resolvedPlatform === 'Exit') { + Log.addNewLineIfNone(); + Log.log('Exiting'); + process.exit(0); + } + return result.resolvedPlatform; } export function toPlatforms(requestedPlatform: RequestedPlatform): Platform[] { From 80f2490b2da9f319cfc3caffd9670c4f7759a993 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Sun, 30 Nov 2025 15:53:40 -0800 Subject: [PATCH 2/2] Clarify prompt functions --- .../src/credentials/manager/SelectPlatform.ts | 4 ++-- packages/eas-cli/src/platform.ts | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/eas-cli/src/credentials/manager/SelectPlatform.ts b/packages/eas-cli/src/credentials/manager/SelectPlatform.ts index 8706545e30..91387841d8 100644 --- a/packages/eas-cli/src/credentials/manager/SelectPlatform.ts +++ b/packages/eas-cli/src/credentials/manager/SelectPlatform.ts @@ -3,7 +3,7 @@ import { ManageIos } from './ManageIos'; import { Analytics } from '../../analytics/AnalyticsManager'; import { DynamicConfigContextFn } from '../../commandUtils/context/DynamicProjectConfigContextField'; import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; -import { selectPlatformAsync } from '../../platform'; +import { selectPlatformWithExitOptionAsync } from '../../platform'; import { Actor } from '../../user/User'; import { Client } from '../../vcs/vcs'; import { CredentialsContextProjectInfo } from '../context'; @@ -20,7 +20,7 @@ export class SelectPlatform { ) {} async runAsync(): Promise { - const platform = await selectPlatformAsync(this.flagPlatform, true /* allowExit */); + const platform = await selectPlatformWithExitOptionAsync(this.flagPlatform); if (platform === 'ios') { await new ManageIos(this, process.cwd()).runAsync(); diff --git a/packages/eas-cli/src/platform.ts b/packages/eas-cli/src/platform.ts index d5df2b3be6..85f49ade51 100644 --- a/packages/eas-cli/src/platform.ts +++ b/packages/eas-cli/src/platform.ts @@ -48,7 +48,14 @@ export async function selectRequestedPlatformAsync(platform?: string): Promise { + return await selectPlatformInternalAsync(platform, true); +} +export async function selectPlatformAsync(platform?: string): Promise { + return await selectPlatformInternalAsync(platform, false); +} + +async function selectPlatformInternalAsync( platform?: string, allowExit?: boolean ): Promise { @@ -69,11 +76,7 @@ export async function selectPlatformAsync( type: 'select', message: 'Select platform', name: 'resolvedPlatform', - choices: [ - { title: 'Android', value: Platform.ANDROID }, - { title: 'iOS', value: Platform.IOS }, - { title: 'Exit', value: 'Exit' }, - ], + choices: platformChoices, }); if (result.resolvedPlatform === 'Exit') { Log.addNewLineIfNone();