feat: add link module
This commit is contained in:
+9
-3
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user