forked from yarnpkg/yarn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlab-resolver.js
29 lines (22 loc) 路 1012 Bytes
/
gitlab-resolver.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* @flow */
import type {ExplodedFragment} from './hosted-git-resolver.js';
import HostedGitResolver from './hosted-git-resolver.js';
export default class GitLabResolver extends HostedGitResolver {
static hostname = 'gitlab.com';
static protocol = 'gitlab';
static getTarballUrl(parts: ExplodedFragment, hash: string): string {
return `https://gitlab.com/${parts.user}/${parts.repo}/repository/archive.tar.gz?ref=${hash}`;
}
static getGitHTTPUrl(parts: ExplodedFragment): string {
return `https://gitlab.com/${parts.user}/${parts.repo}.git`;
}
static getGitSSHUrl(parts: ExplodedFragment): string {
return `git+ssh://git@gitlab.com/${ parts.user }/${ parts.repo }.git`;
}
static getGitSSH(parts: ExplodedFragment): string {
return `git@gitlab.com:${parts.user}/${parts.repo}.git`;
}
static getHTTPFileUrl(parts: ExplodedFragment, filename: string, commit: string): string {
return `https://gitlab.com/${parts.user}/${parts.repo}/raw/${commit}/${filename}`;
}
}