Skip to content

Commit 0513fc5

Browse files
authored
[eas-cli] print no vcs warning only once (#2863)
<!-- 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
1 parent 528988d commit 0513fc5

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages.
1010

1111
### 🐛 Bug fixes
1212

13+
- Print warning for `NoVcsClient` only once. ([#2863](https://github.com/expo/eas-cli/pull/2863) by [@szdziedzic](https://github.com/szdziedzic))
14+
1315
### 🧹 Chores
1416

1517
- Add update support for fingerprint:compare. ([#2850](https://github.com/expo/eas-cli/pull/2850) by [@quinlanj](https://github.com/quinlanj))

packages/eas-cli/src/vcs/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ import { Client } from './vcs';
77

88
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.`;
99

10+
let wasNoVcsWarningPrinted = false;
11+
1012
export function resolveVcsClient(requireCommit: boolean = false): Client {
1113
if (process.env.EAS_NO_VCS) {
1214
if (process.env.NODE_ENV !== 'test') {
13-
// This log might be printed before cli arguments are evaluated,
14-
// so it needs to go to stderr in case command is run in JSON
15-
// only mode.
16-
// eslint-disable-next-line no-console
17-
console.error(chalk.yellow(NO_VCS_WARNING));
15+
if (!wasNoVcsWarningPrinted) {
16+
// This log might be printed before cli arguments are evaluated,
17+
// so it needs to go to stderr in case command is run in JSON
18+
// only mode.
19+
// eslint-disable-next-line no-console
20+
console.error(chalk.yellow(NO_VCS_WARNING));
21+
wasNoVcsWarningPrinted = true;
22+
}
1823
}
1924
return new NoVcsClient();
2025
}

0 commit comments

Comments
 (0)