UNPKG

2.75 kBTypeScriptView Raw
1import { Project } from "./project/project";
2import { GitHubAppCredential, GitHubCredential } from "./secrets";
3export interface CloneOptions {
4 /**
5 * If this is true, the implementation should keep the directory at least
6 * for the duration of the current process. If it's false, persistence can be treated
7 * in any way.
8 */
9 keep?: boolean;
10 /**
11 * If this is true, always make a full clone.
12 * If it's false, and we want the master branch, and we're cloning into a transient
13 * place, then clone with `--depth 1` to save time.
14 */
15 alwaysDeep?: boolean;
16 /**
17 * If we are not doing a deep clone (alwaysDeep is false),
18 * then the default is to clone only one branch.
19 * Set noSingleBranch to true to clone the tips of all branches instead.
20 * This passes `--no-single-branch` to `git clone`.
21 * If alwaysDeep is true, this option has no effect.
22 */
23 noSingleBranch?: boolean;
24 /**
25 * Set this to the number of commits that should be cloned into the transient
26 * place. This only applies when alwaysDeep is set to false.
27 */
28 depth?: number;
29 /**
30 * If you really want the SHA, not the tip of the branch that we've checked out,
31 * then request a detached HEAD at that SHA.
32 */
33 detachHead?: boolean;
34 /**
35 * Path to clone into
36 */
37 path?: string;
38 /**
39 * If set to true symlinks will be cloned as links; if set to false (default)
40 * symlinks are cloned as small files instead.
41 */
42 symLinks?: boolean;
43}
44export declare function gitHubComRepository(details: {
45 owner: string;
46 repo: string;
47 branch?: string;
48 sha?: string;
49 credential: GitHubCredential | GitHubAppCredential;
50}): AuthenticatedRepositoryId<GitHubCredential | GitHubAppCredential>;
51export declare enum RepositoryProviderType {
52 GitHubCom = 0,
53 GitHubEnterprise = 1
54}
55export interface RepositoryId {
56 owner: string;
57 repo: string;
58 branch?: string;
59 sha?: string;
60 type: RepositoryProviderType;
61 apiUrl?: string;
62 gitUrl?: string;
63}
64export interface AuthenticatedRepositoryId<T> extends RepositoryId {
65 credential: T;
66 cloneUrl(): string;
67}
68export interface ProjectLoader {
69 load<C>(id: AuthenticatedRepositoryId<C>, baseDir: string): Promise<Project<C>>;
70 clone<C>(id: AuthenticatedRepositoryId<C>, options?: CloneOptions): Promise<Project<C>>;
71}
72export declare function createProjectLoader(): ProjectLoader;
73export declare class DefaultProjectLoader implements ProjectLoader {
74 load(id: AuthenticatedRepositoryId<any>, baseDir: string): Promise<Project>;
75 clone(id: AuthenticatedRepositoryId<any>, options?: CloneOptions): Promise<Project>;
76}
77//# sourceMappingURL=project.d.ts.map
\No newline at end of file