refactor(dev-infra): several code style and typo fixes (#39135)
This commit addresses comments from [my review][1] on PR #38656 (which was merged without comments addressed). The changes are mostly related to code style and typos. [1]: https://github.com/angular/angular/pull/38656#pullrequestreview-482129333 PR Close #39135
This commit is contained in:
@ -48,7 +48,7 @@ export function spawnWithDebugOutput(
|
||||
childProcess.stderr.on('data', message => {
|
||||
logOutput += message;
|
||||
// If console output is enabled, print the message directly to the stderr. Note that
|
||||
// we intentionally print all output to stderr as stderr should not be polluted.
|
||||
// we intentionally print all output to stderr as stdout should not be polluted.
|
||||
if (outputMode === undefined || outputMode === 'enabled') {
|
||||
process.stderr.write(message);
|
||||
}
|
||||
@ -57,7 +57,7 @@ export function spawnWithDebugOutput(
|
||||
stdout += message;
|
||||
logOutput += message;
|
||||
// If console output is enabled, print the message directly to the stderr. Note that
|
||||
// we intentionally print all output to stderr as stderr should not be polluted.
|
||||
// we intentionally print all output to stderr as stdout should not be polluted.
|
||||
if (outputMode === undefined || outputMode === 'enabled') {
|
||||
process.stderr.write(message);
|
||||
}
|
||||
@ -67,7 +67,7 @@ export function spawnWithDebugOutput(
|
||||
const exitDescription = status !== null ? `exit code "${status}"` : `signal "${signal}"`;
|
||||
const printFn = outputMode === 'on-error' ? error : debug;
|
||||
|
||||
printFn(`Command ${commandText} completed with ${exitDescription}.`);
|
||||
printFn(`Command "${commandText}" completed with ${exitDescription}.`);
|
||||
printFn(`Process output: \n${logOutput}`);
|
||||
|
||||
// On success, resolve the promise. Otherwise reject with the captured stderr
|
||||
|
@ -12,16 +12,16 @@ import {GithubConfig} from '../config';
|
||||
import {GitClient} from './index';
|
||||
|
||||
/** URL to the Github page where personal access tokens can be managed. */
|
||||
export const GITHUB_TOKEN_SETTINGS_URL = `https://github.com/settings/tokens`;
|
||||
export const GITHUB_TOKEN_SETTINGS_URL = 'https://github.com/settings/tokens';
|
||||
|
||||
/** URL to the Github page where personal access tokens can be generated. */
|
||||
export const GITHUB_TOKEN_GENERATE_URL = `https://github.com/settings/tokens/new`;
|
||||
export const GITHUB_TOKEN_GENERATE_URL = 'https://github.com/settings/tokens/new';
|
||||
|
||||
/** Adds the provided token to the given Github HTTPs remote url. */
|
||||
export function addTokenToGitHttpsUrl(githubHttpsUrl: string, token: string) {
|
||||
const url = new URL(githubHttpsUrl);
|
||||
url.username = token;
|
||||
return url.toString();
|
||||
return url.href;
|
||||
}
|
||||
|
||||
/** Gets the repository Git URL for the given github config. */
|
||||
@ -36,7 +36,7 @@ export function getRepositoryGitUrl(config: GithubConfig, githubToken?: string):
|
||||
return baseHttpUrl;
|
||||
}
|
||||
|
||||
/** Gets a Github URL that refers to a lists of recent commits within a specified branch. */
|
||||
/** Gets a Github URL that refers to a list of recent commits within a specified branch. */
|
||||
export function getListCommitsInBranchUrl({remoteParams}: GitClient, branchName: string) {
|
||||
return `https://github.com/${remoteParams.owner}/${remoteParams.repo}/commits/${branchName}`;
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ export class GitClient {
|
||||
*/
|
||||
runGraceful(args: string[], options: SpawnSyncOptions = {}): SpawnSyncReturns<string> {
|
||||
// To improve the debugging experience in case something fails, we print all executed Git
|
||||
// commands unless the `stdio` is explicitly to `ignore` (which is equivalent to silent).
|
||||
// Note that we do not want to print the token if is contained in the command. It's common
|
||||
// commands unless the `stdio` is explicitly set to `ignore` (which is equivalent to silent).
|
||||
// Note that we do not want to print the token if it is contained in the command. It's common
|
||||
// to share errors with others if the tool failed, and we do not want to leak tokens.
|
||||
// TODO: Add support for configuring this on a per-client basis. Some tools do not want
|
||||
// to print the Git command messages to the console at all (e.g. to maintain clean output).
|
||||
@ -202,7 +202,7 @@ export class GitClient {
|
||||
/**
|
||||
* Retrieve the OAuth scopes for the loaded Github token.
|
||||
**/
|
||||
private async getAuthScopesForToken() {
|
||||
private getAuthScopesForToken() {
|
||||
// If the OAuth scopes have already been loaded, return the Promise containing them.
|
||||
if (this._cachedOauthScopes !== null) {
|
||||
return this._cachedOauthScopes;
|
||||
|
@ -6,6 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export * from './semver-matchers';
|
||||
export * from './virtual-git-client';
|
||||
export * from './virtual-git-matchers';
|
||||
export * from './semver-matchers';
|
||||
|
@ -123,7 +123,7 @@ export class VirtualGitClient extends GitClient {
|
||||
this.branches[ref.destination] = {
|
||||
branch: ref.destination,
|
||||
ref: this.fetchHeadRef,
|
||||
newCommits: []
|
||||
newCommits: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ export class VirtualGitClient extends GitClient {
|
||||
}
|
||||
this.head = {ref: this.fetchHeadRef, newCommits: []};
|
||||
} else if (this.branches[target]) {
|
||||
this.head = {...this._cloneHead(this.branches[target], detached)};
|
||||
this.head = this._cloneHead(this.branches[target], detached);
|
||||
} else if (createBranch) {
|
||||
this.head = this.branches[target] = {branch: target, ...this._cloneHead(this.head, detached)};
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user