From 0513fc51a64d12307e1ab261ada71d5f83c740de Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Tue, 4 Feb 2025 10:02:37 +0100 Subject: [PATCH] [eas-cli] print no vcs warning only once (#2863) # Why https://exponent-internal.slack.com/archives/C017N0N99RA/p1738630158821649 # How Print warn message only once # Test Plan Tests --- CHANGELOG.md | 2 ++ packages/eas-cli/src/vcs/index.ts | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eef3b7897..5fe9116884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐Ÿ› Bug fixes +- Print warning for `NoVcsClient` only once. ([#2863](https://github.com/expo/eas-cli/pull/2863) by [@szdziedzic](https://github.com/szdziedzic)) + ### ๐Ÿงน Chores - Add update support for fingerprint:compare. ([#2850](https://github.com/expo/eas-cli/pull/2850) by [@quinlanj](https://github.com/quinlanj)) diff --git a/packages/eas-cli/src/vcs/index.ts b/packages/eas-cli/src/vcs/index.ts index 82a2526b24..a65b1f5d1e 100644 --- a/packages/eas-cli/src/vcs/index.ts +++ b/packages/eas-cli/src/vcs/index.ts @@ -7,14 +7,19 @@ import { Client } from './vcs'; const NO_VCS_WARNING = `Using EAS CLI without version control system is not recommended, use this mode only if you know what you are doing.`; +let wasNoVcsWarningPrinted = false; + export function resolveVcsClient(requireCommit: boolean = false): Client { if (process.env.EAS_NO_VCS) { if (process.env.NODE_ENV !== 'test') { - // This log might be printed before cli arguments are evaluated, - // so it needs to go to stderr in case command is run in JSON - // only mode. - // eslint-disable-next-line no-console - console.error(chalk.yellow(NO_VCS_WARNING)); + if (!wasNoVcsWarningPrinted) { + // This log might be printed before cli arguments are evaluated, + // so it needs to go to stderr in case command is run in JSON + // only mode. + // eslint-disable-next-line no-console + console.error(chalk.yellow(NO_VCS_WARNING)); + wasNoVcsWarningPrinted = true; + } } return new NoVcsClient(); }