feat: add link module

This commit is contained in:
2026-11-10 15:32:51 +03:00
parent 7615dbfc48
commit 4997fed725
11 changed files with 165 additions and 130 deletions
+9 -3
View File
@@ -2,10 +2,13 @@ import os from "os";
import path from "path";
import download from "../common/download";
import { Logger } from "../common/log";
import { resolveLink, type Link } from "./link";
export class Sdk {
static _dir: string;
url!: string;
static set dir(value) {
Sdk._dir = value;
}
@@ -45,8 +48,11 @@ export class Sdk {
throw "Not implemented";
}
get link(): string {
throw "Not implemented";
get link(): string | Link {
return {
version: this.version,
url: this.url,
};
}
prepare(strip = 1): Promise<any> {
@@ -55,7 +61,7 @@ export class Sdk {
return Promise.resolve();
} else {
this.log.i("download: *%s*", this.link);
return download(this.link, this.path, { strip });
return download(resolveLink(this.link, this), this.path, { strip });
}
}
}