forked from yarnpkg/yarn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-resolver.js
29 lines (22 loc) 路 1017 Bytes
/
bitbucket-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 BitbucketResolver extends HostedGitResolver {
static hostname = 'bitbucket.org';
static protocol = 'bitbucket';
static getTarballUrl(parts: ExplodedFragment, hash: string): string {
return `https://bitbucket.org/${parts.user}/${parts.repo}/get/${hash}.tar.gz`;
}
static getGitHTTPUrl(parts: ExplodedFragment): string {
return `https://bitbucket.org/${parts.user}/${parts.repo}.git`;
}
static getGitSSHUrl(parts: ExplodedFragment): string {
return `git+ssh://git@bitbucket.org/${ parts.user }/${ parts.repo }.git`;
}
static getGitSSH(parts: ExplodedFragment): string {
return `git@bitbucket.org:${parts.user}/${parts.repo}.git`;
}
static getHTTPFileUrl(parts: ExplodedFragment, filename: string, commit: string): string {
return `https://bitbucket.org/${parts.user}/${parts.repo}/raw/${commit}/${filename}`;
}
}