Skip to content

Commit

Permalink
[eas-cli] print no vcs warning only once (#2863)
Browse files Browse the repository at this point in the history
<!-- 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

https://exponent-internal.slack.com/archives/C017N0N99RA/p1738630158821649

# How

Print warn message only once

# Test Plan

Tests
  • Loading branch information
szdziedzic authored Feb 4, 2025
1 parent 528988d commit 0513fc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
15 changes: 10 additions & 5 deletions packages/eas-cli/src/vcs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 0513fc5

Please sign in to comment.