Skip to content

Commit

Permalink
[eas-cli] print no vcs warning only once
Browse files Browse the repository at this point in the history
  • Loading branch information
szdziedzic committed Feb 4, 2025
1 parent 528988d commit 7373174
Showing 1 changed file with 10 additions and 5 deletions.
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 7373174

Please sign in to comment.