From 32848f6255b233db458dcaa94f42c3f2fba21510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Mon, 18 Mar 2024 13:03:42 +0100 Subject: [PATCH] Log dirty files in non-interactive when bailing (#2288) --- CHANGELOG.md | 2 ++ packages/eas-cli/src/build/configure.ts | 2 +- packages/eas-cli/src/build/utils/repository.ts | 13 ++++++++++++- packages/eas-cli/src/vcs/clients/git.ts | 5 +++++ packages/eas-cli/src/vcs/vcs.ts | 3 +++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b972644f..a5c1066f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐ŸŽ‰ New features +- Print uncommitted files in non-interactive mode if they fail the execution. ([#2288](https://github.com/expo/eas-cli/pull/2288) by [@sjchmiela](https://github.com/sjchmiela)) + ### ๐Ÿ› Bug fixes ### ๐Ÿงน Chores diff --git a/packages/eas-cli/src/build/configure.ts b/packages/eas-cli/src/build/configure.ts index 22414a3939..10682ea829 100644 --- a/packages/eas-cli/src/build/configure.ts +++ b/packages/eas-cli/src/build/configure.ts @@ -40,7 +40,7 @@ async function configureAsync({ nonInteractive, vcsClient, }: ConfigureParams): Promise { - await maybeBailOnRepoStatusAsync(vcsClient); + await maybeBailOnRepoStatusAsync(vcsClient, nonInteractive); await createEasJsonAsync(projectDir, vcsClient); diff --git a/packages/eas-cli/src/build/utils/repository.ts b/packages/eas-cli/src/build/utils/repository.ts index 5c6874c4c4..929e2bb271 100644 --- a/packages/eas-cli/src/build/utils/repository.ts +++ b/packages/eas-cli/src/build/utils/repository.ts @@ -12,7 +12,10 @@ import { getTmpDirectory } from '../../utils/paths'; import { endTimer, formatMilliseconds, startTimer } from '../../utils/timer'; import { Client } from '../../vcs/vcs'; -export async function maybeBailOnRepoStatusAsync(vcsClient: Client): Promise { +export async function maybeBailOnRepoStatusAsync( + vcsClient: Client, + nonInteractive: boolean +): Promise { if (!(await vcsClient.isCommitRequiredAsync())) { return; } @@ -28,6 +31,11 @@ export async function maybeBailOnRepoStatusAsync(vcsClient: Client): Promise { + const gitStatusOutput = await gitStatusAsync({ showUntracked: true }); + Log.log(gitStatusOutput); + } + public override async hasUncommittedChangesAsync(): Promise { const changes = await gitStatusAsync({ showUntracked: true }); return changes.length > 0; diff --git a/packages/eas-cli/src/vcs/vcs.ts b/packages/eas-cli/src/vcs/vcs.ts index 72101c8050..189f777c7c 100644 --- a/packages/eas-cli/src/vcs/vcs.ts +++ b/packages/eas-cli/src/vcs/vcs.ts @@ -51,6 +51,9 @@ export abstract class Client { // `commitAsync({ commitAllFiles: false })` public async showDiffAsync(): Promise {} + /** (optional) print list of changed files */ + public async showChangedFilesAsync(): Promise {} + // (optional) returns hash of the last commit // used for metadata - implementation can be safely skipped public async getCommitHashAsync(): Promise {