Skip to content

Commit 759d749

Browse files
authored
[eas-cli] suggest using eas build:dev when using simulator/emulator dev client configuration (#2929)
* [eas-cli] suggest using eas build:dev when using simulator/emulator dev client configuration * add changelog
1 parent 34c307c commit 759d749

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ This is the log of notable changes to EAS CLI and related packages.
1414

1515
### 🧹 Chores
1616

17+
- Suggest using `eas build:dev` for matching configurations. ([#2929](https://github.com/expo/eas-cli/pull/2929) by [@szdziedzic](https://github.com/szdziedzic))
18+
1719
## [15.0.13](https://github.com/expo/eas-cli/releases/tag/v15.0.13) - 2025-03-04
1820

1921
### 🐛 Bug fixes

packages/eas-cli/src/build/runBuildAndSubmit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export async function runBuildAndSubmitAsync({
122122
envOverride?: Env;
123123
}): Promise<{
124124
buildIds: string[];
125+
buildProfiles?: ProfileData<'build'>[];
125126
}> {
126127
await vcsClient.ensureRepoExistsAsync();
127128
await ensureRepoIsCleanAsync(vcsClient, flags.nonInteractive);
@@ -348,6 +349,7 @@ export async function runBuildAndSubmitAsync({
348349
}
349350
return {
350351
buildIds: startedBuilds.map(({ build }) => build.id),
352+
buildProfiles,
351353
};
352354
}
353355

packages/eas-cli/src/commands/build/index.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Platform } from '@expo/eas-build-job';
2-
import { EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json';
2+
import { BuildProfile, EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json';
33
import { LoggerLevel } from '@expo/logger';
44
import { Errors, Flags } from '@oclif/core';
55
import chalk from 'chalk';
@@ -17,6 +17,7 @@ import { RequestedPlatform, selectRequestedPlatformAsync } from '../../platform'
1717
import { selectAsync } from '../../prompts';
1818
import uniq from '../../utils/expodash/uniq';
1919
import { enableJsonOutput } from '../../utils/json';
20+
import { ProfileData } from '../../utils/profiles';
2021
import { maybeWarnAboutEasOutagesAsync } from '../../utils/statuspageService';
2122

2223
interface RawBuildFlags {
@@ -160,7 +161,7 @@ export default class Build extends EasCommand {
160161

161162
const flagsWithPlatform = await this.ensurePlatformSelectedAsync(flags);
162163

163-
await runBuildAndSubmitAsync({
164+
const { buildProfiles } = await runBuildAndSubmitAsync({
164165
graphqlClient,
165166
analytics,
166167
vcsClient,
@@ -169,6 +170,11 @@ export default class Build extends EasCommand {
169170
actor,
170171
getDynamicPrivateProjectConfigAsync,
171172
});
173+
174+
this.maybeSuggestUsingEasBuildDev({
175+
buildProfiles,
176+
nonInteractive: flags.nonInteractive,
177+
});
172178
}
173179

174180
private sanitizeFlags(
@@ -268,6 +274,51 @@ export default class Build extends EasCommand {
268274
requestedPlatform,
269275
};
270276
}
277+
278+
private maybeSuggestUsingEasBuildDev({
279+
buildProfiles,
280+
nonInteractive,
281+
}: {
282+
buildProfiles: ProfileData<'build'>[] | undefined;
283+
nonInteractive: boolean;
284+
}): void {
285+
// suggest using eas build:dev if the build configuration results in simulator/emulator dev client build
286+
if (
287+
!nonInteractive &&
288+
!process.env.CI &&
289+
buildProfiles?.some(({ profile, platform }) => {
290+
if (profile.developmentClient !== true) {
291+
return false;
292+
}
293+
if (profile.distribution !== 'internal') {
294+
return false;
295+
}
296+
297+
if (platform === Platform.IOS) {
298+
const iosProfile = profile as BuildProfile<Platform.IOS>;
299+
if (iosProfile.simulator !== true && iosProfile.withoutCredentials !== true) {
300+
return false;
301+
}
302+
} else {
303+
const androidProfile = profile as BuildProfile<Platform.ANDROID>;
304+
if (
305+
androidProfile.distribution !== 'internal' &&
306+
androidProfile.withoutCredentials !== true
307+
) {
308+
return false;
309+
}
310+
}
311+
return true;
312+
})
313+
) {
314+
Log.newLine();
315+
Log.log(
316+
`🔎 TIP: You are using a build configuration that could benefit from using ${chalk.bold(
317+
'eas build:dev'
318+
)} command. Run it to install and run cached development build, or create a new one if a compatible build doesn't exist yet.`
319+
);
320+
}
321+
}
271322
}
272323

273324
export async function handleDeprecatedEasJsonAsync(

0 commit comments

Comments
 (0)