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:
@@ -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;
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user