Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] suggest using eas build:dev when using simulator/emulator dev client configuration #2929

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/eas-cli/src/build/runBuildAndSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export async function runBuildAndSubmitAsync({
envOverride?: Env;
}): Promise<{
buildIds: string[];
buildProfiles?: ProfileData<'build'>[];
}> {
await vcsClient.ensureRepoExistsAsync();
await ensureRepoIsCleanAsync(vcsClient, flags.nonInteractive);
Expand Down Expand Up @@ -348,6 +349,7 @@ export async function runBuildAndSubmitAsync({
}
return {
buildIds: startedBuilds.map(({ build }) => build.id),
buildProfiles,
};
}

Expand Down
44 changes: 42 additions & 2 deletions packages/eas-cli/src/commands/build/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -169,6 +170,8 @@ export default class Build extends EasCommand {
actor,
getDynamicPrivateProjectConfigAsync,
});

this.maybeSuggestUsingEasBuildDev(buildProfiles);
}

private sanitizeFlags(
Expand Down Expand Up @@ -268,6 +271,43 @@ export default class Build extends EasCommand {
requestedPlatform,
};
}

private maybeSuggestUsingEasBuildDev(buildProfiles?: ProfileData<'build'>[]): void {
// suggest using eas build:dev if the build configuration results in simulator/emulator dev client build
if (
buildProfiles?.some(({ profile, platform }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also not show this message on CI

if (profile.developmentClient !== true) {
return false;
}
if (profile.distribution !== 'internal') {
return false;
}

if (platform === Platform.IOS) {
const iosProfile = profile as BuildProfile<Platform.IOS>;
if (iosProfile.simulator !== true && iosProfile.withoutCredentials !== true) {
return false;
}
} else {
const androidProfile = profile as BuildProfile<Platform.ANDROID>;
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 dev client build or create a new one if it doesn't exist.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)} command. Run it to install and run cached dev client build or create a new one if it doesn't exist.`
)} 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(
Expand Down
Loading