chore: consistent naming of parseGitUrl

This commit is contained in:
Fredrik Adelöw
2021-01-15 14:52:03 +01:00
parent 6e382fc4c7
commit 0b4b755b91
12 changed files with 28 additions and 27 deletions
@@ -23,7 +23,7 @@ import {
readBitbucketIntegrationConfigs,
} from '@backstage/integration';
import fetch from 'cross-fetch';
import parseGitUri from 'git-url-parse';
import parseGitUrl from 'git-url-parse';
import { Readable } from 'stream';
import { NotFoundError } from '../errors';
import { ReadTreeResponseFactory } from './tree';
@@ -101,8 +101,9 @@ export class BitbucketUrlReader implements UrlReader {
url: string,
options?: ReadTreeOptions,
): Promise<ReadTreeResponse> {
const gitUrl: parseGitUri.GitUrl = parseGitUri(url);
const { name: repoName, owner: project, resource, filepath } = gitUrl;
const { name: repoName, owner: project, resource, filepath } = parseGitUrl(
url,
);
const isHosted = resource === 'bitbucket.org';
@@ -142,7 +143,7 @@ export class BitbucketUrlReader implements UrlReader {
}
private async getLastCommitShortHash(url: string): Promise<String> {
const { name: repoName, owner: project, ref } = parseGitUri(url);
const { name: repoName, owner: project, ref } = parseGitUrl(url);
let branch = ref;
if (!branch) {
@@ -21,7 +21,7 @@ import {
getGitHubRequestOptions,
} from '@backstage/integration';
import fetch from 'cross-fetch';
import parseGitUri from 'git-url-parse';
import parseGitUrl from 'git-url-parse';
import { Readable } from 'stream';
import { InputError, NotFoundError } from '../errors';
import { ReadTreeResponseFactory } from './tree';
@@ -92,7 +92,7 @@ export class GithubUrlReader implements UrlReader {
resource,
full_name,
filepath,
} = parseGitUri(url);
} = parseGitUrl(url);
if (!ref) {
// TODO(Rugvip): We should add support for defaulting to the default branch
@@ -29,7 +29,7 @@ import {
ReadTreeResponse,
UrlReader,
} from './types';
import parseGitUri from 'git-url-parse';
import parseGitUrl from 'git-url-parse';
import { Readable } from 'stream';
export class GitlabUrlReader implements UrlReader {
@@ -85,7 +85,7 @@ export class GitlabUrlReader implements UrlReader {
resource,
full_name,
filepath,
} = parseGitUri(url);
} = parseGitUrl(url);
if (!ref) {
throw new InputError(