aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation/interfaces.ts
blob: 03eac5b797a1c9348217a46277b8c9d398e2a640 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
export interface GithubRepo {
    name: string;
    owner: string;
}

/**
 * Metadata about particular artifact retrieved from GitHub releases.
 */
export interface ArtifactMetadata {
    releaseName: string;
    downloadUrl: string;
}

/**
 * Type tag for `BinarySource` discriminated union.
 */
export enum BinarySourceType { ExplicitPath, GithubBinary }

/**
 * Represents the source of a binary artifact which is either specified by the user
 * explicitly, or bundled by this extension from GitHub releases.
 */
export type BinarySource = ExplicitPathSource | GithubBinarySource;


export interface ExplicitPathSource {
    type: BinarySourceType.ExplicitPath;

    /**
     * Filesystem path to the binary specified by the user explicitly.
     */
    path: string;
}

export interface GithubBinarySource {
    type: BinarySourceType.GithubBinary;

    /**
     * Repository where the binary is stored.
     */
    repo: GithubRepo;

    /**
     * Directory on the filesystem where the bundled binary is stored.
     */
    dir: string;

    /**
     * Name of the binary file. It is stored under the same name on GitHub releases
     * and in local `.dir`.
     */
    file: string;
}