aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation/interfaces.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-19 08:06:48 +0000
committerGitHub <[email protected]>2020-03-19 08:06:48 +0000
commitaca3c3086ee99f5770a60970e20af640c895d42a (patch)
tree2f0b3233cc4728436ba5e47a6e91e7df33585d43 /editors/code/src/installation/interfaces.ts
parent55336722b3662cbdcc9e1b92a3e27ed0442d2452 (diff)
parentfb6e655de8a44c65275ad45a27bf5bd684670ba0 (diff)
Merge #3629
3629: Alternative aproach to plugin auto update r=matklad a=matklad This is very much WIP (as in, I haven't run this once), but I like the result so far. cc @Veetaha The primary focus here on simplification: * local simplification of data structures and control-flow: using union of strings instead of an enum, using unwrapped GitHub API responses * global simplification of control flow: all logic is now in `main.ts`, implemented as linear functions without abstractions. This is stateful side-effective code, so arguments from [Carmack](http://number-none.com/blow/john_carmack_on_inlined_code.html) very much apply. We need all user interractions, all mutations, and all network requests to happen in a single file. * as a side-effect of condensing everything to functions, we can get rid of various enums. The enums were basically a reified control flow: ``` enum E { A, B } fn foo() -> E { if cond { E::A } else { E::B } } fn bar(e: E) { match e { E::A => do_a(), E::B => do_b(), } } ==>> fn all() { if cond { do_a() } else { do_b() } } ``` * simplification of model: we don't need to reinstall on settings update, we can just ask the user to reload, we don't need to handle nightly=>stable fallback, we can ask the user to reinstall extension, (todo) we don't need to parse out the date from the version, we can use build id for nightly and for stable we can write the info directly into package.json. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/installation/interfaces.ts')
-rw-r--r--editors/code/src/installation/interfaces.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/editors/code/src/installation/interfaces.ts b/editors/code/src/installation/interfaces.ts
deleted file mode 100644
index 1a8ea0884..000000000
--- a/editors/code/src/installation/interfaces.ts
+++ /dev/null
@@ -1,63 +0,0 @@
1export interface GithubRepo {
2 name: string;
3 owner: string;
4}
5
6/**
7 * Metadata about particular artifact retrieved from GitHub releases.
8 */
9export interface ArtifactReleaseInfo {
10 releaseDate: Date;
11 releaseName: string;
12 downloadUrl: string;
13}
14
15/**
16 * Represents the source of a an artifact which is either specified by the user
17 * explicitly, or bundled by this extension from GitHub releases.
18 */
19export type ArtifactSource = ArtifactSource.ExplicitPath | ArtifactSource.GithubRelease;
20
21export namespace ArtifactSource {
22 /**
23 * Type tag for `ArtifactSource` discriminated union.
24 */
25 export const enum Type { ExplicitPath, GithubRelease }
26
27 export interface ExplicitPath {
28 type: Type.ExplicitPath;
29
30 /**
31 * Filesystem path to the binary specified by the user explicitly.
32 */
33 path: string;
34 }
35
36 export interface GithubRelease {
37 type: Type.GithubRelease;
38
39 /**
40 * Repository where the binary is stored.
41 */
42 repo: GithubRepo;
43
44
45 // FIXME: add installationPath: string;
46
47 /**
48 * Directory on the filesystem where the bundled binary is stored.
49 */
50 dir: string;
51
52 /**
53 * Name of the binary file. It is stored under the same name on GitHub releases
54 * and in local `.dir`.
55 */
56 file: string;
57
58 /**
59 * Tag of github release that denotes a version required by this extension.
60 */
61 tag: string;
62 }
63}