refactor(dev-infra): use a singleton for GitClient (#41515)

Creates a singleton class for GitClient rather than relying on creating an instance to
require being passed around throughout its usages.

PR Close #41515
This commit is contained in:
Joey Perrott
2021-04-08 12:34:55 -07:00
committed by Zach Arend
parent c20db69f9f
commit 9bf8e5164d
32 changed files with 439 additions and 323 deletions
+4
View File
@@ -7,8 +7,11 @@
*/
import {Argv} from 'yargs';
import {error, red, yellow} from '../console';
import {GITHUB_TOKEN_GENERATE_URL} from './github-urls';
import {GitClient} from './index';
export type ArgvWithGithubToken = Argv<{githubToken: string}>;
@@ -29,6 +32,7 @@ export function addGithubTokenOption(yargs: Argv): ArgvWithGithubToken {
error(yellow(`You can generate a token here: ${GITHUB_TOKEN_GENERATE_URL}`));
process.exit(1);
}
GitClient.authenticateWithToken(githubToken);
return githubToken;
},
})