From e9936a568b01e66c00a2dd4f2ac7ef0292297bf9 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Wed, 5 Mar 2025 12:46:38 +0100 Subject: [PATCH 1/2] [eas-cli] suggest using eas build:dev when using simulator/emulator dev client configuration --- .../eas-cli/src/build/runBuildAndSubmit.ts | 2 + packages/eas-cli/src/commands/build/index.ts | 55 ++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/packages/eas-cli/src/build/runBuildAndSubmit.ts b/packages/eas-cli/src/build/runBuildAndSubmit.ts index 6b1e4d3f94..b7227cf62b 100644 --- a/packages/eas-cli/src/build/runBuildAndSubmit.ts +++ b/packages/eas-cli/src/build/runBuildAndSubmit.ts @@ -122,6 +122,7 @@ export async function runBuildAndSubmitAsync({ envOverride?: Env; }): Promise<{ buildIds: string[]; + buildProfiles?: ProfileData<'build'>[]; }> { await vcsClient.ensureRepoExistsAsync(); await ensureRepoIsCleanAsync(vcsClient, flags.nonInteractive); @@ -348,6 +349,7 @@ export async function runBuildAndSubmitAsync({ } return { buildIds: startedBuilds.map(({ build }) => build.id), + buildProfiles, }; } diff --git a/packages/eas-cli/src/commands/build/index.ts b/packages/eas-cli/src/commands/build/index.ts index 497ed13d13..ae3dbd9fcf 100644 --- a/packages/eas-cli/src/commands/build/index.ts +++ b/packages/eas-cli/src/commands/build/index.ts @@ -1,5 +1,5 @@ import { Platform } from '@expo/eas-build-job'; -import { EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json'; +import { BuildProfile, EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json'; import { LoggerLevel } from '@expo/logger'; import { Errors, Flags } from '@oclif/core'; import chalk from 'chalk'; @@ -17,6 +17,7 @@ import { RequestedPlatform, selectRequestedPlatformAsync } from '../../platform' import { selectAsync } from '../../prompts'; import uniq from '../../utils/expodash/uniq'; import { enableJsonOutput } from '../../utils/json'; +import { ProfileData } from '../../utils/profiles'; import { maybeWarnAboutEasOutagesAsync } from '../../utils/statuspageService'; interface RawBuildFlags { @@ -160,7 +161,7 @@ export default class Build extends EasCommand { const flagsWithPlatform = await this.ensurePlatformSelectedAsync(flags); - await runBuildAndSubmitAsync({ + const { buildProfiles } = await runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, @@ -169,6 +170,11 @@ export default class Build extends EasCommand { actor, getDynamicPrivateProjectConfigAsync, }); + + this.maybeSuggestUsingEasBuildDev({ + buildProfiles, + nonInteractive: flags.nonInteractive, + }); } private sanitizeFlags( @@ -268,6 +274,51 @@ export default class Build extends EasCommand { requestedPlatform, }; } + + private maybeSuggestUsingEasBuildDev({ + buildProfiles, + nonInteractive, + }: { + buildProfiles: ProfileData<'build'>[] | undefined; + nonInteractive: boolean; + }): void { + // suggest using eas build:dev if the build configuration results in simulator/emulator dev client build + if ( + !nonInteractive && + !process.env.CI && + buildProfiles?.some(({ profile, platform }) => { + if (profile.developmentClient !== true) { + return false; + } + if (profile.distribution !== 'internal') { + return false; + } + + if (platform === Platform.IOS) { + const iosProfile = profile as BuildProfile; + if (iosProfile.simulator !== true && iosProfile.withoutCredentials !== true) { + return false; + } + } else { + const androidProfile = profile as BuildProfile; + if ( + androidProfile.distribution !== 'internal' && + androidProfile.withoutCredentials !== true + ) { + return false; + } + } + return true; + }) + ) { + Log.addNewLineIfNone(); + Log.log( + `๐Ÿ”Ž You are using a build configuration that could benefit from using ${chalk.bold( + 'eas build:dev' + )} command. Run it to install and run cached development build, or create a new one if a compatible build doesn't exist yet.` + ); + } + } } export async function handleDeprecatedEasJsonAsync( From a87155c53ee3cf0cadd73410609a2cb7eaecdaf0 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Thu, 6 Mar 2025 14:53:27 +0100 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 2 ++ packages/eas-cli/src/commands/build/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccab1e71f6..b223baede5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐Ÿงน Chores +- Suggest using `eas build:dev` for matching configurations. ([#2929](https://github.com/expo/eas-cli/pull/2929) by [@szdziedzic](https://github.com/szdziedzic)) + ## [15.0.13](https://github.com/expo/eas-cli/releases/tag/v15.0.13) - 2025-03-04 ### ๐Ÿ› Bug fixes diff --git a/packages/eas-cli/src/commands/build/index.ts b/packages/eas-cli/src/commands/build/index.ts index ae3dbd9fcf..dd32bcf69f 100644 --- a/packages/eas-cli/src/commands/build/index.ts +++ b/packages/eas-cli/src/commands/build/index.ts @@ -311,9 +311,9 @@ export default class Build extends EasCommand { return true; }) ) { - Log.addNewLineIfNone(); + Log.newLine(); Log.log( - `๐Ÿ”Ž You are using a build configuration that could benefit from using ${chalk.bold( + `๐Ÿ”Ž TIP: You are using a build configuration that could benefit from using ${chalk.bold( 'eas build:dev' )} command. Run it to install and run cached development build, or create a new one if a compatible build doesn't exist yet.` );