Skip to content

Commit

Permalink
[eas-cli] auto start dev client server at the end of eas build:dev (#…
Browse files Browse the repository at this point in the history
…2868)

<!-- If this PR requires a changelog entry, add it by commenting the PR with the command `/changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]`. -->
<!-- You can skip the changelog check by labeling the PR with "no changelog". -->

# Why

Auto-start dev client server at the end of `eas build:dev` command

# How

Auto-start dev client server at the end of `eas build:dev` command

# Test Plan

Tested manually

[Screen Recording 2025-02-04 at 13.00.38.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/9YRXgAETSTRMfjZ0IP35/fabf33a3-77e4-474f-a5fe-71725446769f.mov" />](https://app.graphite.dev/media/video/9YRXgAETSTRMfjZ0IP35/fabf33a3-77e4-474f-a5fe-71725446769f.mov)
  • Loading branch information
szdziedzic authored Feb 4, 2025
1 parent 8a2d68f commit 85a6662
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/eas-cli/src/commands/build/dev.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Platform } from '@expo/eas-build-job';
import { BuildProfile, EasJsonAccessor } from '@expo/eas-json';
import { Errors, Flags } from '@oclif/core';
import chalk from 'chalk';

import {
createBuildProfileAsync,
Expand All @@ -19,6 +20,7 @@ import Log from '../../log';
import { RequestedPlatform } from '../../platform';
import { resolveWorkflowAsync } from '../../project/workflow';
import { confirmAsync, promptAsync } from '../../prompts';
import { expoCommandAsync } from '../../utils/expoCli';
import { createFingerprintAsync } from '../../utils/fingerprintCli';
import { ProfileData, getProfilesAsync } from '../../utils/profiles';
import { Client } from '../../vcs/vcs';
Expand Down Expand Up @@ -122,6 +124,7 @@ export default class BuildDev extends EasCommand {

if (build.artifacts?.applicationArchiveUrl) {
await downloadAndRunAsync(build);
await this.startDevServerAsync({ projectDir, platform });
return;
} else {
Log.warn('Artifacts for this build expired. New build will be started.');
Expand Down Expand Up @@ -169,6 +172,7 @@ export default class BuildDev extends EasCommand {
downloadSimBuildAutoConfirm: true,
envOverride: env,
});
await this.startDevServerAsync({ projectDir, platform });
}

private async selectPlatformAsync(platform?: Platform): Promise<Platform> {
Expand Down Expand Up @@ -324,4 +328,24 @@ export default class BuildDev extends EasCommand {
limit: 1,
});
}

private async startDevServerAsync({
projectDir,
platform,
}: {
projectDir: string;
platform: Platform;
}): Promise<void> {
Log.newLine();
Log.log(
`Starting development server: ${chalk.dim(
`npx expo start --dev-client ${platform === Platform.IOS ? '--ios' : '--android'}`
)}`
);
await expoCommandAsync(projectDir, [
'start',
'--dev-client',
platform === Platform.IOS ? '--ios' : '--android',
]);
}
}

0 comments on commit 85a6662

Please sign in to comment.